×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

MATLAB and Java threads

MATLAB and Java threads

MATLAB and Java threads

(OP)
Objective:

MATLAB script launches a Java Gui and gives control to the Gui.  The Gui collects user data.  The user presses a button and the Java method returns control to MATLAB.


Implementation:

The MATLAB script calls a user defined Java method.  The Java method builds two threads.  The first thread builds the Gui (with a button) and builds an Action Listener for the button.  The second thread calls .wait().  When the Action Listener is invoked it calls .notifyall().  The waiting thread should wake up, complete, and the Java method that built the threads returns control to MATLAB.



Problem:

When .wait() is called the ActionListener goes dead and MATLAB locks up.


Question:

Why does the ActionListener go dead and MATLAB lock up?  Does MATLAB change the ordinary operation of Java threads?


Additional details:

When my user defined Java method builds the new threads, .start() does nothing, I have to directly invoke .run().  Does this imply something is wrong with the threads?



Any way to fix this implementation or suggestions for another are very welcome!  Thank you. :)

RE: MATLAB and Java threads

(OP)
There is a way to assign MATLAB callback functions to Java gui components that resond to action events:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.html

However, action listeners launched from within Java methods do work. I just can't get the syncronization to work. Without doing any kind of wait, Java action listeners work fine. I don't know if the MATLAB callbacks will take care of the wait issue for me or not. Guess I'll find out.

Anyone else have any information about MATLAB and Java threads?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources