MATLAB Answers

How can I bring in the MATLAB App Designer's Workspace variables back into Base Workspace?

3 views (last 30 days)
Sunil Kumar Giri
Sunil Kumar Giri on 2 Sep 2020
Hello MATLAB Enthusiasts,
I have made an APP using MATLAB App Designer which does the following operations sequentially as follows-
  1. Runs a MATLAB Script that provids Simulink Model with necessary Input Signals as prerequisite for running the model successfully using the command
eavalin('base','Model_Name');
2. Start simulating the Model (There are several 'To Workspace' blocks to write the Simulink result data to the Base Workspace) using the interactive command from App designer as following
simout = sim('Model_Name','Solver','ode3','StartTime','simstart','StopTime','simend','FixedStep','0.0001');
The model is running perfectly fine but the problem is that, 'To Workspace' signals are not getting logged into Base Workspace (I am not sure about the reason, but I suspect whether App designer has it's separate Workspace)
I tried to use the following command as well to bring the App's workspace (If any) variables to Base Workspace of MATLAB.
simout = sim('Model_Name','Solver','ode3','StartTime','simstart','StopTime','simend','FixedStep','0.0001','ReturnWorkspaceOutputs','on');
3. After capturing the Simulink output signals (using the variables stored in base workspace as a result of using To Workspace blocks in Simulink Model), I need to run another Script which would plot and compare the various engineering parameters with Inputs and Outputs for correlation and comparison as follows
evalin('base','Plot_Script');
However, this is also not working out as expected and is throwing error such as the Simulation output signals are unavailable.
Error:- Undefined function or variable 'Signal_Name'
Now as, I am not able to get the Simulation Output Variables back into base workspace, I am not able to proceed further with the final step.
Please enlighten on this in detail.

Answers (0)

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by