Results 1 to 16 of 16

Thread: DoEvents in MATLAB *resolved*

  1. #1

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375

    DoEvents in MATLAB *resolved*

    Has anyone ever used MATLAB? If you have, can you point me to any functions that are equivalent to DoEvents in VB?

    I have a while loop, but the user can't press any buttons while that loop is active...and so the loop can't be terminated.


    Thanks.
    Last edited by nishantp; Jul 30th, 2003 at 02:39 PM.
    You just proved that sig advertisements work.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Why are you asking in Chit Chat? You know you wont get a serious answer.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    We havn't really got a special forum for this do we?


    EDIT - do you think the mods will be mad if I ask in Gen VB?
    You just proved that sig advertisements work.

  4. #4
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    I seem to remember that there is a sleep() command in matlab

  5. #5
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Originally posted by nishantp
    EDIT - do you think the mods will be mad if I ask in Gen VB?
    Do you honestly think we take this job so seriously we actually get worked up and mad about people posting in the wrong forums ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Might try General PC if its not directly VB related. Its just too easy for people to give you a silly answer here, so thats why i said something.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    Is this a grahics/drawing issue? If it is you could use the drawnow function (see HELP DRAWNOW)


    Most people want fast calculations so Matlab runs its calculations at
    normal priority. If you are willing to give Matlab less access to the
    CPU (thus increasing calculation time) you can change the priority
    (how to do this depends on your operating system)

  8. #8

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Originally posted by PeteD
    I seem to remember that there is a sleep() command in matlab
    Since it's not in the documentation, they might have taken it out of the newer versions of MATLAB (they've done a lot of that ), but thanks.

    Cander and Plenderj - Ok I'm going to ask in Gen VB then, thanks.
    You just proved that sig advertisements work.

  9. #9
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    see my edited post above

  10. #10

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Originally posted by PeteD
    Is this a grahics/drawing issue? If it is you could use the drawnow function (see HELP DRAWNOW)


    Most people want fast calculations so Matlab runs its calculations at
    normal priority. If you are willing to give Matlab less access to the
    CPU (thus increasing calculation time) you can change the priority
    (how to do this depends on your operating system)
    Its a fairly simple situation...but I'm new to MATLAB. Sometimes I think I should have done it in VB.


    All i'm doing it putting a play and a stop button. The Play button activated a loop that plays a waveform, (with wavplay()) until the user presses Stop. But the user can't press stop while the loop is running, which presents the problem. A DoEvents like function would be perfect.
    You just proved that sig advertisements work.

  11. #11
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    They introduced timers in one of the fairly recent versions of matlab I think.

    Does your VB code interact with you matlab code? Could you put doevents in your VB code?

  12. #12

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Originally posted by PeteD
    They introduced timers in one of the fairly recent versions of matlab I think.

    Does your VB code interact with you matlab code? Could you put doevents in your VB code?
    No no, Its all being done in MATLAB. And as far as I know, MATLAB can only interact directly with C and C++.
    You just proved that sig advertisements work.

  13. #13
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    I think you have to use windows messages to interact with matlab code. I'm not a matlab expert by any means, but have worked on a VB app that integrated with matlab code. A collegue did all the matlab integration work, but I'm sure he ended up posting windows messages.

  14. #14

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    First of all, thanks for the help. What exactly do you mean by 'windows messages'?
    You just proved that sig advertisements work.

  15. #15
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    Originally posted by nishantp
    First of all, thanks for the help. What exactly do you mean by 'windows messages'?
    Some info here, but I'd reccomend you search google
    http://www.exaflop.org/docs/vbsubclass/ind.html

    have a look on www.mathworks.com, some good matlab info here

    and here

    http://www.mathtools.net/MATLAB/Refe.../Visual_Basic/
    Last edited by PeteD; Jul 30th, 2003 at 10:21 AM.

  16. #16

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    It seems that even though it had nothing to do with graphics, DrawNow() does the job. Thanks everyone.
    You just proved that sig advertisements work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width