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

3 次查看(过去 30 天)
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 个评论
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?

请先登录,再进行评论。

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by