フィルターのクリア

Is it possible to create global variables (objects) of custom classes in Simulink?

26 ビュー (過去 30 日間)
Roop
Roop 2024 年 7 月 18 日
編集済み: Roop 2024 年 8 月 5 日 13:25
Hello,
I have a custom class that returns an object of complex data types, such as structs, variable-data type cell arrays, and AppDesigner classes. I am looking to use this object in multiple MATLAB Fcn blocks to call different methods at different points in my simulation.
Previous Attempts:
Base Workspace - tried initializing object in PreLoadFcn callback but it is recognized as undefined in the MATLAB Fcn block
Model Workspace - initialized the object successfully as object of my custom class, but I get the
error: "Expression 'gObj' for initial value of data 'gObj' must evaluate to logical or supported numeric type."
Any suggestions?

回答 (1 件)

Yash Sharma
Yash Sharma 2024 年 8 月 5 日 9:45
Hi Roop,
You can take a look at the following Matlab answer to answer your query.
Hope it helps!
  1 件のコメント
Roop
Roop 2024 年 8 月 5 日 13:24
編集済み: Roop 2024 年 8 月 5 日 13:25
Hi Yash,
Thanks for linking the resources! I had a chance to look through them, but I could never find any functionality that allows me to manipulate the same instance of a class (same object) across multiple MATLAB Fcn Blocks or MATLAB System Blocks.
In all of the linked examples, each block is creating a new instance of the class. Do you have any help regarding this question?

サインインしてコメントする。

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by