You can retrieve the entire list of variables using "Simulink.findVars" and then construct another list based on what class of variables you are looking for. See the following example:
allVars = Simulink.findVars(modelName, 'SourceType', 'base workspace');
myVars = Simulink.VariableUsage;
myVars(1) = '';
desiredClass = 'Simulink.Parameter';
for i = 1:length(allVars)
tmp = evalin('base',allVars(i).Name);
if strcmp(class(tmp),desiredClass)
myVars(end+1) = allVars(i);
end
end
The resulting list of Simulink.Parameter objects will be found in "myVars"
Best Answer