MATLAB Answers

How can I get a list of all user-settable Simulink model settings that are evaluated?

1 ビュー (過去 30 日間)
Robert
Robert 2017 年 11 月 1 日
編集済み: Robert 2017 年 11 月 14 日
How can I get a list of all user-settable Simulink model settings that are evaluated (strings that are executed as code to get the property value)?
I want this as part of my effort to programmatically find all base workspace variable references in the configuration settings of my Simulink model. For example, the property 'ExternalInput' references a Simulink Dataset in my base workspace. As far as this question is concerned, it would be just as well if it didn't reference that Dataset; what I really want is a list of all the model properties that could reference a variable.
So far, I know I can get all the model (let's call it my_model) properties with:
h = get_param(my_model, 'Handle');
properties = get(h);
allowed = set(h);
From these, I can search for properties whose values are strings and allowed to be anything. ( set returns an empty cell for these.)
fields = intersect(filenames(properties), fieldnames(allowed));
fields = fields(cellfun(@(f) ischar(properties.(f)) & is empty(allowed.(f)), fields));
But this still includes properties such as 'Name' and 'ToolBar' that are never evaluated and so don't matter in this context.

  0 件のコメント

サインインしてコメントする。

回答 (0 件)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by