Code in GUI doesn't continue after running .m file

Hi everyone! I'm pretty new to Matlab and have a problem with my GUI using app desiner. I run a .m file after pushing a button,which works fine, but the code in appdesigner doesn't seem to continue afterwards (display table from generated .mat file). When commenting out "run myfile.m" the rest of the code works fine. Any ideas what I did wrong?

6 Comments

Hi Lisa,
What operation does myfile.m file perform, can you post sample code?
Shishir.
Hi Shishir,
The .m file creates a table following the restrictions given in the GUI. The code from the .m file is more or less:
load('myGUI_variables'); run code1.m run code2.m (Within these codes there are just basic equations and at their end: Save('myResults.mat','a','b',...,'-append'); Clc; Clear; Load('myResults.mat'); ) In the main code I establish the table from these results, that I get displayed in the command window (command at the end of the code).
Last command is:
save('myResults.mat','myTable');
The code works until here, as I can access the wanted table through the .mat file. In my GUI I want to enable a 'display results' button after the code is done, but there the code seems to stop and nothing happens. Any idea what I did wrong?
What is the reason that the code is placed in the .m file and not within the GUI methods?
Not really apart from the code being pretty long and I feel that it gets quite messy. Although if there is no other solution there would be no problem placing the code within the GUI :)
Tried placing it in the GUI but now it won't work but I don't get any error messages... :/ Other ideas maybe?
Update: solved the problem by placing the code to enable a button I wanted to enable after 'run myFile.m' before it. Not sure why but the button is enabled after running the code :D

Sign in to comment.

Answers (1)

Hello,
I think you need to add 'table' in your GUI (assuming you haven't added 'table' or haven't used 'uitable'). Write your myFile.m under callback of push button and pass that result to callback of 'table' show that desired table can be visible in GUI.
Please refer these to links :

Categories

Find more on Historical Contests in Help Center and File Exchange

Asked:

on 26 Dec 2019

Answered:

on 30 Dec 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!