- If a MATLAB Variable is being used as in the question, you can directly declare the data type of the variable along with its values as follows:

- You can use a Simulink Parameter instead of a MATLAB Variable which allows you to edit the data type interactively. You can then call this variable as a value in a block's parameter in your model.

- You can set the data type directly in the Block Parameters window. An example of the Switch block 'Threshold' parameter is shown below:

- You can perform (1), (2) and (3) using Model Data Editor too. You can find the Model Data Editor docked at the bottom left corner of your Simulink window by default or open it by navigating to 'Modeling' tab > 'Design' section > clicking on 'Model Data Editor' in the Simulink toolstrip.

How do I change the default parameter or variable data type in Simulink?
8 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2022 年 3 月 10 日
回答済み: MathWorks Support Team
2022 年 4 月 7 日
When I create a variable in Simulink Model Workspace, the default data type is set to 'double' which does not seem to be editable. How can I change this default data type?

採用された回答
MathWorks Support Team
2023 年 12 月 5 日
There are multiple ways you can change the data type of a Model Workspace variable:
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!