Borrar filtros
Borrar filtros

How to create and rename a bus?

7 visualizaciones (últimos 30 días)
geieraffe
geieraffe el 13 de Jul. de 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)?

Respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by