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
Santiago Jose Flores Siguenza 2022 年 8 月 3 日
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
Santiago Jose Flores Siguenza 2022 年 8 月 3 日
I found it. The property is called "Props.Array.Size" Hopefully this helps someone in the future.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by