MATLAB GUI does not finish execution when called from another MATLAB based GUI.
Hi Everyone,
I have a MATLAB R2020b gui based application which basically is a menu with buttons and each button press is another MATLAB GUI based executable. The problem is that when I run the main wrapper GUI and press a button, it successfuly launches the executable associated with that. The inner gui based executable is supposed to interface with HW and collect data, save and close and return back the execution to the main GUI. However the problem is that once the inner gui executable saves the data using the save function, it somehow gets frozen, hangs. Nothing happens.
Now here are some other strange observations.
When I run the same deployed setup with extended screens connected to my laptop, it works.
When I run the inner gui directly by double clicking it instead of calling it as a button press from the outer gui, it works.
If I comment out the save function inside the inner GUI, the data doesn’t get saved but the program executes and it works.
I have not been able to undestand this weird behavior. Has someone encountered this behavior before ?
Here is the code inside the launcher.exe that executes on a button press and calls another GUI (executbable)
function abc_Callback(hObject, eventdata, handles)
handles.abc.Enable = ‘off’;
pause(0.2)
try
executablePath = fullfile(handles.rootdirectory, ‘folder1’, ‘folder2’, ‘abc.exe’);
command = sprintf(‘"%s"’, executablePath);
[status] = system(execFileNameWithExt);
catch e
disp(e)
end
handles.abc.Enable = ‘on’;
Also here is where the save function is run. I added some debug lines before and after the save function and realized that
msgbox(‘calling "save" function inside generatereport’);
save(fullfile(res.Report.reportDir,reportName),’res’);
msgbox(‘executed the "save" function inside generatereport, now on line 99’);
now the 2nd msgbox never gets executed. However the save function does save the res object currently at the desired location.
How do you think I should try to debug this problem ? Should i use the logs ?Hi Everyone,
I have a MATLAB R2020b gui based application which basically is a menu with buttons and each button press is another MATLAB GUI based executable. The problem is that when I run the main wrapper GUI and press a button, it successfuly launches the executable associated with that. The inner gui based executable is supposed to interface with HW and collect data, save and close and return back the execution to the main GUI. However the problem is that once the inner gui executable saves the data using the save function, it somehow gets frozen, hangs. Nothing happens.
Now here are some other strange observations.
When I run the same deployed setup with extended screens connected to my laptop, it works.
When I run the inner gui directly by double clicking it instead of calling it as a button press from the outer gui, it works.
If I comment out the save function inside the inner GUI, the data doesn’t get saved but the program executes and it works.
I have not been able to undestand this weird behavior. Has someone encountered this behavior before ?
Here is the code inside the launcher.exe that executes on a button press and calls another GUI (executbable)
function abc_Callback(hObject, eventdata, handles)
handles.abc.Enable = ‘off’;
pause(0.2)
try
executablePath = fullfile(handles.rootdirectory, ‘folder1’, ‘folder2’, ‘abc.exe’);
command = sprintf(‘"%s"’, executablePath);
[status] = system(execFileNameWithExt);
catch e
disp(e)
end
handles.abc.Enable = ‘on’;
Also here is where the save function is run. I added some debug lines before and after the save function and realized that
msgbox(‘calling "save" function inside generatereport’);
save(fullfile(res.Report.reportDir,reportName),’res’);
msgbox(‘executed the "save" function inside generatereport, now on line 99’);
now the 2nd msgbox never gets executed. However the save function does save the res object currently at the desired location.
How do you think I should try to debug this problem ? Should i use the logs ? Hi Everyone,
I have a MATLAB R2020b gui based application which basically is a menu with buttons and each button press is another MATLAB GUI based executable. The problem is that when I run the main wrapper GUI and press a button, it successfuly launches the executable associated with that. The inner gui based executable is supposed to interface with HW and collect data, save and close and return back the execution to the main GUI. However the problem is that once the inner gui executable saves the data using the save function, it somehow gets frozen, hangs. Nothing happens.
Now here are some other strange observations.
When I run the same deployed setup with extended screens connected to my laptop, it works.
When I run the inner gui directly by double clicking it instead of calling it as a button press from the outer gui, it works.
If I comment out the save function inside the inner GUI, the data doesn’t get saved but the program executes and it works.
I have not been able to undestand this weird behavior. Has someone encountered this behavior before ?
Here is the code inside the launcher.exe that executes on a button press and calls another GUI (executbable)
function abc_Callback(hObject, eventdata, handles)
handles.abc.Enable = ‘off’;
pause(0.2)
try
executablePath = fullfile(handles.rootdirectory, ‘folder1’, ‘folder2’, ‘abc.exe’);
command = sprintf(‘"%s"’, executablePath);
[status] = system(execFileNameWithExt);
catch e
disp(e)
end
handles.abc.Enable = ‘on’;
Also here is where the save function is run. I added some debug lines before and after the save function and realized that
msgbox(‘calling "save" function inside generatereport’);
save(fullfile(res.Report.reportDir,reportName),’res’);
msgbox(‘executed the "save" function inside generatereport, now on line 99’);
now the 2nd msgbox never gets executed. However the save function does save the res object currently at the desired location.
How do you think I should try to debug this problem ? Should i use the logs ? r2020b, gui, guide, matlab, application MATLAB Answers — New Questions