Variant Subsystem variant control condition defined by previous subsystem output

15 views (last 30 days)
How can I use a previous block output as the the control variable ? (connecting the constant value output to the variant subsystem is useless because the conditions variables are supposed to be determined by base-workspace variables in the case of variant subsystems)
Error evaluating properties of Simulink.Variant object 'a' in workspace 'base' (used by block '....../Variant Subsystem')
Caused by: Variant condition 'ind==1' should return a logical value Attempt to reference field of non-structure array.
http://www.mathworks.com/matlabcentral/answers/69974-writing-value-to-workspace-and-taking-that-value-from-workspace-to-be-used-in-another-model-part So I understand variant subsystems aren't helpful for parameters that aren't constant during simulation, but what about parameters that are determined only at the beginning of the simulation?
by the way: I tried using Block priorites+ To workspace block, But I was limited by the condition variable type int8 (Timeseries form, couldn't change it), so that ind.Data==int8(1) didn't work as a condition....

Accepted Answer

Guy Rouleau
Guy Rouleau on 19 Aug 2013
This is not what variant subsystems have been designed for. Use a if-else construct, a Switch, or other options like the ones I described here:
  1 Comment
Idan
Idan on 19 Aug 2013
Edited: Idan on 19 Aug 2013
For somehow I still don't understand in which cases variant subsystems are helpfull (only one execution path determined by base workspace variable? / Is it for static configuration of the simulation?)

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!