Simulink Conditional Execution with From Workspace Block
7 views (last 30 days)
Show older comments
I am trying to setup a simple conditional execution where based on a test one of two From Workspace blocks is selected i.e., is test is true then I want to load data1 from workspace while if test is false I want to load data2. My problem is that only data1 or data2 will be present in the workspace (and it will correspond to the test condition). When I try to run the simulation, I get a variable not found error for the missing data1 or data2 even though based on the test condition that From Workspace block will not have to be executed. I was expecting the conditonal input branch execution to take care of this and not bother about the From Workspace block for the condition that will not be run. I have tried to acheive this in many ways including switch block, enabled subsystem, if and if action blocks but everytime I am getting the same issue.
What am I doing wrong and how can I solve this problem?
0 Comments
Answers (1)
TAB
on 28 Jun 2012
If you are using some block in the model and you are resolving the value in the block form the work-space, then variable must be present in the workspace.
Conditonal input branch execution is performed in optimization stage of the model compilation. Prior to it simulink evaluates the model's block parameter expressions to determine their values. So all the parameters used in the model should be present before compilation is started.
0 Comments
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!