Stateflow get dimension of variable
Ältere Kommentare anzeigen
I would like to get the dimension of an input/parameter to a stateflow model?
C code would be something like this.
Vartype Var[MaxArraySize];
size_t MaxArraySize = sizeof(Var) / sizeof(Vartype);
Antworten (1)
Fangjun Jiang
am 15 Feb. 2024
0 Stimmen
If action language is MATLAB, you can use size(input), or size(input,1), size(input,2)
2 Kommentare
Roger Innes
am 23 Feb. 2024
Fangjun Jiang
am 23 Feb. 2024
size( input )(x) is not valid in MATLAB.
"Using size( input, x) where x = 1 I got the length of the 1 by 3 matrix as 3"
If not specified, a 1x3 or 3x1 vector in Simulink shows size as 3 (at least in Simulink diagram signal line). If you specify the dimension of "input" as 1x3, I think size(input,1) will return 1.
Kategorien
Mehr zu Simulink Functions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!