Using struct as a constant input in Simulink
Mostra commenti meno recenti
Hey all,
I have currently some trouble with using structs as a constant input in Simulink. As seen in my script, I generate first the struct and then the assosicated bus as data type for my "Constant"-Block in Simulink:
% ST as struct
ST = struct;
ST.A1 = 1;
ST.A2 = 2;
ST.B3 = 3;
% bus_ST as data type
busInfo = Simulink.Bus.createObject(ST);
bus_ST = eval(busInfo.busName);
In the attached screenshot you can see my simulink model. The Constant Block has the constant value "ST" and the output data type is "Bus: bus_ST". The simulation runs without errors, but I do not get any values from my "simout". My "simout" is a struct with three timeseries, but they are all empty.
I also tested the ex_constantbus model from the documentation. This works without problem and delivers the outputs from the constant block. But I do not know why it works there and not in my model. Does anybody know the reason or a solution?
Apart from that, is there another option to rename the bus, instead using the eval() function? Perhabs directly in 'Simulink.BuscreateObject()'? Thanks in advance.
Risposte (0)
Categorie
Scopri di più su Block Libraries in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!