How do i use and index an array in an "else-if" expression in Simulink?
1 view (last 30 days)
Show older comments
I have a Matrix of Values that i want to use in an "else-if" expression of an If-Block
Is it only possible to index a list e.g. L(1) but not an matrix e.g. L(1,1) in this scenario? Because Simulink sees the comma as the start of the next expression.
% Possible
u1>=L_R(1) & u1<L_R(2),
% Not Possible
u1>=L_R(1,1) & u1<L_R(2,1),
Error: "The expression u1 >= L(2" has a syntax error
Does anyone have an idea for a Workaround?
0 Comments
Accepted Answer
Benjamin Thompson
on 25 Jan 2022
Edited: Benjamin Thompson
on 25 Jan 2022
What is L_R? I do not think the if subsystem block in Simulink allows any symbols other than uN, where N is between 1 and the number of inputs you put in the block mask. If L_R is like a model workspace parameter or something like that, can you just add a second input to the if block (or more than 1) and let the block handle all of them as uN, replacing all L_R references with ua, ub, uc, etc. The block probably won't accept a matrix as an input.
2 Comments
Benjamin Thompson
on 25 Jan 2022
Use a constant block to access L_R(1,1) and pass it to the input of an if block.
More Answers (0)
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!