How to create and rename a bus?

9 views (last 30 days)
geieraffe
geieraffe on 13 Jul 2016
My actual question is: How can I assign a (new) name to a variable, whose name I do not know explicitly?
But maybe some one has a much nicer way for the complete thing I want to do:
- I have a nested struct
- I want to create a bus structure from it
- I want this bus to have a specific name
For now, this is my way to do this:
myStruct = struct();
myStruct.a.aa = 1;
myStruct.a.ab = 2;
myStrcht.b.ba = 3;
myStruct.c.ca = 4;
busInfo = Simulink.Bus.createObject(myStruct);
myBus = eval(busInfo.busName);
Is there a way to avoid eval()?
Or is there a way to specify, how the bus should be named in busInfo (mybe even the sub busses)?

Answers (0)

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!