Filter löschen
Filter löschen

How to create and rename a bus?

3 Ansichten (letzte 30 Tage)
geieraffe
geieraffe am 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)?

Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by