MATLAB Answers

0

Can I find where a Simulink.Signal object is stored based on a Data Store Read/Write in the model?

Hadi Zyien 님이 질문을 제출함. 28 Sep 2018
최근 활동 Hadi Zyien 님이 댓글을 추가함. 30 Oct 2018
Simulink.Signal objects can be stored in the base workspace, model workspace, and/or a data dictionary. If I have a Data Store Read or Write that refers to a Simulink.Signal object (i.e., a "global" data store), is it possible to determine which one it is using? Can I do this programmatically? Using the get_param function on the data store read/write does not show any useful parameters that could associate a data store to its definition.

  댓글 수: 0

로그인 to comment.

답변 수: 1

Answer by TAB
on 28 Sep 2018
Edited by TAB
on 28 Sep 2018
 Accepted Answer

If Simulink.Signal object name is "x"
>> varInfo = Simulink.findVars('MyModel','Name','x')
varInfo =
VariableUsage with properties:
Name: 'x'
Source: 'base workspace'
SourceType: 'base workspace'
Users: {[1x26 char]}

  댓글 수: 3

Thanks! That was exactly what I needed. Is there any way I can get the data store's DataType and Dimensions?
get_param('MyModel/Data Store Memory', 'OutDataTypeStr')
get_param('MyModel/Data Store Memory', 'Dimensions')
I am not sure that this works for Simulink.Signal objects:
get_param(varInfo.Users{1}, 'OutDataTypeStr')
DataStoreRead block does not have a parameter named 'OutDataTypeStr'
How can I use the Simulink.Signal name to find the Data Type and Dimensions?

로그인 to comment.



Translated by