How to modify MATLAB Block "Data Type" parameters from a script?

3 views (last 30 days)
I'm trying to write a Function which accepts some parameters and opens, unlocks, creates a MATLAB Function Block in a Library, populates it with MATLAB Code and locks it again.
My current function already does almost everything and is mostly based on this example:
For the uses of my Blocks and the whole use of automatizing this process, I don't want to go every time to the library, unlock it and specify the Ports and Data Manager parameters for input and output of the functions, as it automatically gets as "Size: -1" and for the Type "Inherit: Same as Simulink". Is there a way to specify these parameters that are available through "Data Types" inside the MATLAB Function Block programatically?
I plan to expand this script and let it do these changes later from a GUI. So any comments and tips are helpful. Thanks in advance!
  1 Comment
Santiago Jose Flores Siguenza
Update: after reading and modifying the code from the next example:
I am able to set the data type succesfully. For the Size I still am not finding the correct Property of the Stateflow Data.
If I write A.outputs(1).Size I get "Unrecognized property 'Size' for class 'Stateflow.Data'."
Is there any way I can achieve to modify it without using the GUI?

Sign in to comment.

Accepted Answer

Santiago Jose Flores Siguenza
I found it. The property is called "Props.Array.Size" Hopefully this helps someone in the future.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!