How to eval expressions in Simulink Data Dictionaries

조회 수: 2 (최근 30일)
Klaus
Klaus 2014년 9월 4일
댓글: Sebastian Castro 2015년 2월 12일
Is there any way to set the value of an object of a Simulink data dictionary to an expression containing other data dictionary objects?
E.g. given an object x1 in a data dictionary d1.sldd, I want to set the value to 2*x1 of on object x2 in a data dictionary d2.sldd.
If there is no way, is Mathworks planning to add this feature in future releases?

답변 (4개)

Yair Altman
Yair Altman 2015년 2월 11일
For anyone interested, Donn Shull has just posted a detailed article explaining the Simulink Data Dictionary's undocumented API here: http://undocumentedmatlab.com/blog/simulink-data-dictionary
  댓글 수: 1
Sebastian Castro
Sebastian Castro 2015년 2월 12일
Great article for those who are looking for a way to script their dictionaries!
You may have noticed that the undocumented APIs are slightly different in R2014a than in R2014b. In fact, the reason we haven't published this is that this API is still a work in progress. In a future release we'll see a different (and documented) API, and we can't guarantee backwards compatibility with R2014a/R2014b.
Just something to watch out for if you plan to upgrade versions.
- Sebastian

댓글을 달려면 로그인하십시오.


Sebastian Castro
Sebastian Castro 2014년 10월 2일
Hello Klaus,
MathWorks is planning on adding this feature in a future release, but right now there isn't anything visible, unfortunately.
- Sebastian

Matthew Manthey
Matthew Manthey 2014년 12월 4일
Hi Sebastian,
I am to interpret your response such that it is not possible to read/write a Simulink data dictionary programmatically (via m-script)? I would like to read and modify a data dictionary file via m-script. Is this possible?
Thanks, Matt

Donn Shull
Donn Shull 2015년 2월 5일
h1 = Simulink.dd.open('d1.sldd')
h2 = Simulink.dd.open('d2.sldd')
x1 = h1.getEntry('Global.x1')
x2 = h2.getEntry('Global.x2')
x2.Value = 2*x1.Value
h2.setEntry('Global.x2', x2)
h2.saveChanges
h1.close
h2.close
h1.delete
h2.delete

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by