Info
此问题已关闭。 请重新打开它进行编辑或回答。
How can I get a list of all user-settable Simulink model settings that are evaluated?
2 次查看(过去 30 天)
显示 更早的评论
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!