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

1 回表示 (過去 30 日間)
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.
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 9 月 2 日
assignin('base') from the same function you call sim()?
Sunil Kumar Giri
Sunil Kumar Giri 2020 年 9 月 2 日
Thank you Walter. It works!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by