Simulink Conditional Execution with From Workspace Block

조회 수: 7 (최근 30일)
Sriram Narasimhan
Sriram Narasimhan 2012년 6월 27일
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?

답변 (1개)

TAB
TAB 2012년 6월 28일
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.
See Model Compilation for more details.

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by