Subscribe Bookmark RSS Feed

Calling a MATLAB GUI from JSL

nqj

Occasional Contributor

Joined:

May 19, 2017

Hi everyone,

 

I'm trying to call a MATLAB GUI from JSL which allows the user to upload an image and plot a custom spline over the image from user-generated points. The GUI mostly works with the exception of one callback function that lets the user adjust the already created spline. In the MATLAB interface it works perfectly but I receive an 'Unexpected MATLAB operator' error in the JSL log. After using 'MATLAB Control(Visible(1))' it shows that the 'Struct contents reference from a non-struct array object,' followed by errors in the code for the callback function 'Invalid or deleted object.' My suspicion is that the JSL code is terminating before the callback can change the variables in MATLAB, but the other buttons on my GUI function perfectly well. Has anyone had experience debugging a MATLAB GUI from JSL? Thanks for any and all help.

 

Best,

Noah

1 ACCEPTED SOLUTION

Accepted Solutions
nqj

Occasional Contributor

Joined:

May 19, 2017

Solution

I managed to figure out what the problem was. For anyone with a similar issue, the steps required are:

 

1) Save all functions (including callback functions) as .m files, separate from the script that creates the GUI.

2) Use MATLAB Submit("cd 'pathname'") to point to the directory containing the function files.

3) Use MATLAB Submit File('pathname to GUI script') to call the GUI.

 

Everything is working smoothly now.

1 REPLY
nqj

Occasional Contributor

Joined:

May 19, 2017

Solution

I managed to figure out what the problem was. For anyone with a similar issue, the steps required are:

 

1) Save all functions (including callback functions) as .m files, separate from the script that creates the GUI.

2) Use MATLAB Submit("cd 'pathname'") to point to the directory containing the function files.

3) Use MATLAB Submit File('pathname to GUI script') to call the GUI.

 

Everything is working smoothly now.