Can the value of a parameter in a model workspace be determined programatically and not dirty the model workspace?

조회 수: 1 (최근 30일)
The only way I know of to determine the value of a parameter in the model workspace is like this:
hws = get_param('mymodel','modelworkspace'); p = hws.evalin('param');
Howevever, the call to evalin makes the model workspace dirty. Is there a way to get the value of param and keep the model workspace clean? It would be nice if there was:
p = hws.read('param');
which would have no effect on the cleanliness of the model workspace.
  댓글 수: 3
Doug Eastman
Doug Eastman 2012년 4월 3일
Dirty means that MATLAB thinks the file has changed since it was last saved on disk and is indicated by an * next to the name in the title bar. This results in for example a dialog box popping up when the model/file is closed asking if you want to save changes.
In this context the model workspace being dirty means that the model itself is dirty.

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

채택된 답변

Doug Eastman
Doug Eastman 2011년 1월 28일
Here is one way that does not dirty the model:
hws = get_param('mymodel','modelworkspace');
myData = hws.data;
p = myData(strcmp({myData.Name},'param')).Value;
clear('myData')
  댓글 수: 3
Doug Eastman
Doug Eastman 2011년 2월 1일
I thought I did see it in the doc, but now I can't find it so maybe not. I'm pretty sure I first saw this by hitting tab after typing 'hws.' to see a list of all the properties and methods, something I generally do when playing with new objects.
Paul
Paul 2011년 2월 1일
I found it using the tab approach also. Should I be worried about using an undocumented method? I wonder why it and others are not documented. hws.data and hws.isDirty are very useful.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by