Using a Bus array inside of a Bus using cellToObject
1 view (last 30 days)
Show older comments
Matlab version: 7.10.0.499 (R2010a) 32-bit
Hi,
I need to create a bus array inside of a bus using the function Simulink.Bus.cellToObject. Please review the following code:
str = 'subcell = {';
str = [str '{''SUBBUS'','''',sprintf(''''),{'];
str = [str '{''index'',1, ''double'', -1, ''real'', ''Sample'', ''Fixed''};'];
str = [str '{''value'',1, ''double'', -1, ''real'', ''Sample'', ''Fixed''};'];
str = [str '}}};'];
eval(str);
Simulink.Bus.cellToObject(subcell);
str = 'cell = {';
str = [str '{''BUS'','''',sprintf(''''),{'];
str = [str '{''a'',1, ''double'', -1, ''real'', ''Sample'', ''Fixed''};'];
str = [str '{''b'',5, ''SUBBUS'', -1, ''real'', ''Sample'', ''Fixed''};'];
str = [str '{''c'',1, ''double'', -1, ''real'', ''Sample'', ''Fixed''};'];
str = [str '}}};'];
eval(str);
Simulink.Bus.cellToObject(cell);
The matlab code compiles. However, the dimension of the SUBBUS is somehow ignored. I know that arrays of buses were introduced with the 2010b version (i am using 2010a) as i found this in the web:
"Arrays of structures are not allowed in 10a. Structure parameters can be thought of as an analogue of bus signals, and arrays of buses are not currently allowed in Simulink."
Is there any other way to implement this in another fashion without updating to 2010b?
Best regards, Oyun Kwon
0 Comments
Answers (2)
MarkB
on 7 Mar 2011
I don't believe that there is any real analogue to this in releases earlier than 2010b. The closest thing that you could do is make a bus instead of an array at the top level where that bus happens to be a bunch of identical sub-buses, but this lacks the ability to use numerical indexing that would be possible with an array at the top level.
0 Comments
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!