Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

MATLAB and Java threads

Status
Not open for further replies.

essentiallytight

Computer
Joined
Sep 1, 2005
Messages
2
Location
US
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. :)
 
There is a way to assign MATLAB callback functions to Java gui components that resond to action events:


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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top