Effacer les filtres
Effacer les filtres

How to create and rename a bus?

3 vues (au cours des 30 derniers jours)
geieraffe
geieraffe le 13 Juil 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)?

Réponses (0)

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by