How to load a ".mat" in a GUI which can perform a SIMULIMK model

1 view (last 30 days)
Hello everyone,
I am trying to couple GUI and SIMULINK and make them work together. To do that, I made a script to do my GUI in which I put the following code:
% Before there is the code to open my GUI
load workspace
sim('mcp_sim_ENTPE.slx')
The problem is the next: when I run the script directly from Matlab, it works because datas of workspace are directly saved in the Matlab workspace. However, this window is the third one in my GUI and when I click on the next pushbutton of my second one and then that my third window appears, it seems that nothing happens except the appearance of the following error message which is the same that the one when I do not load my 'workspace.mat' file.
Error using second_page (line 48)
Error due to multiple causes.
Error in first_page>next_button (line 116)
second_page;
Caused by:
Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/S-Function1' for parameter 'dt'. Error using second_page (line 48)
Error evaluating parameter 'dt' in 'mcp_sim_ENTPE/S-Function1' Error using second_page (line 48)
Undefined function or variable 'dt'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text1' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text1' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text3' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text3' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text4' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text4' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text5' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text5' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text6' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text6' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text7' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text7' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Text8' for parameter 'VariableName'. Error using second_page (line 48)
Error evaluating parameter 'VariableName' in 'mcp_sim_ENTPE/Text8' Error using second_page (line 48)
Undefined function or variable 'pcm_Exp'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Unit Delay' for parameter 'SampleTime'. Error using second_page (line 48)
Error evaluating parameter 'SampleTime' in 'mcp_sim_ENTPE/Unit Delay' Error using second_page (line 48)
Undefined function or variable 'dt'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Unit Delay1' for parameter 'SampleTime'. Error using second_page (line 48)
Error evaluating parameter 'SampleTime' in 'mcp_sim_ENTPE/Unit Delay1' Error using second_page (line 48)
Undefined function or variable 'dt'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Unit Delay2' for parameter 'SampleTime'. Error using second_page (line 48)
Error evaluating parameter 'SampleTime' in 'mcp_sim_ENTPE/Unit Delay2' Error using second_page (line 48)
Undefined function or variable 'dt'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Unit Delay3' for parameter 'SampleTime'. Error using second_page (line 48)
Error evaluating parameter 'SampleTime' in 'mcp_sim_ENTPE/Unit Delay3' Error using second_page (line 48)
Undefined function or variable 'dt'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Unit Delay4' for parameter 'SampleTime'. Error using second_page (line 48)
Error evaluating parameter 'SampleTime' in 'mcp_sim_ENTPE/Unit Delay4' Error using second_page (line 48)
Undefined function or variable 'dt'. Error using second_page (line 48)
Invalid setting in 'mcp_sim_ENTPE/Unit Delay5' for parameter 'SampleTime'. Error using second_page (line 48)
Error evaluating parameter 'SampleTime' in 'mcp_sim_ENTPE/Unit Delay5' Error using second_page (line 48)
Undefined function or variable 'dt'.
Error while evaluating DestroyedObject Callback
So my question is : how can I load the 'workspace.mat' to run my Simulink model through GUI?
Thank you for your answer,
Dorian

Answers (0)

Categories

Find more on Event Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!