Is it possible to create global variables (objects) of custom classes in Simulink?
    9 次查看(过去 30 天)
  
       显示 更早的评论
    
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?
0 个评论
回答(1 个)
  Yash Sharma
      
 2024-8-5
        Hi Roop,
You can take a look at the following Matlab answer to answer your query.
Hope it helps!
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!