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

dirtyevalinmodel workspacesimulink

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.

Best Answer

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')