MATLAB Answers

Using complex structure in simulink constant block

6 views (last 30 days)
Hello,
I know that there is way to pass structure to simulink model as bus object but what should I do if i need to pass complex structure with structures as fields?
Example of structure:
Structure.A.a=1;
Structure.B.a=2;
Are there any another way to pass complex set of data to simulink model without accessing it to block parameters?

  0 Comments

Sign in to comment.

Accepted Answer

stozaki
stozaki on 18 Jan 2020
Edited: stozaki on 18 Jan 2020
Hello,
Please try attached model.
  1. execute bus object definition file.
  2. Simulate model.
MathWorks dcoumentation : Simulink.Bus.createMATLABStruct
Regards,
stozaki

  3 Comments

Sergey Kasyanov
Sergey Kasyanov on 20 Jan 2020
That works, thanks!
But that is too unhandy. First stuff (I encounter) which is more complex in command form then in GUI. Maybe it should be changed in future releases?
stozaki
stozaki on 20 Jan 2020
Thank you for checking.
I cannot describe future releases in MATLAB Anser. We appreciate your understanding.
I understand your opinion that scripting is complicated.
Bus nested can be created graphically using the Bus Editor. You can automatically generate a bus definition file from the Bus Editor.
Regards,
stozaki
Sergey Kasyanov
Sergey Kasyanov on 20 Jan 2020
I can not use GUI because I am working with complex structures)
I worry about program approach to that problem because it is working only if I have structure with no repeating fields. If I want to create bus:
A.A.A.a=1;
A.A.B.d=1;
A.B.A.b=1;
A.B.B.c=1;
...% and so on
what should I do?
Can I send offer to developers to fix that situation?

Sign in to comment.

More Answers (0)

Sign in to answer this question.