No BSD License
Highlights from
getp
from
getp
by squirrel squirrel
This script returns property-value pairs of a simulink model, block or line
|
| out=getp(varargin) |
function out=getp(varargin)
% Syntax: GETP(SYS), GETP(SYS,PROP)
% Usage: GETP(SYS,PROP) returns the property value PROP of the simulink
% model or block SYS.
% GETP(SYS) displays all property names and values.
% Unlike GET_PARAM(SYS,'OBJECTPARAMETERS') the function GETP
% displays the property values
%
% Example:
% getp('vdp')
% getp('vdp','name')
%
% Written by Tobias Gemperli 13 April 2006
if nargin==1
a=get_param(varargin{1},'ObjectParameters');
fn=fieldnames(a);
for ifn=1:length(fn)
try
if strcmp(fn{ifn},'Jacobian') & strcmp(getp('AnalyticLinearization'),'off')
str=[];
elseif strcmp(fn{ifn},'RTWAdaCheckedOutLicense') % License Manager error
str='off';
else
str=get_param(varargin{1},fn{ifn});
end
catch
str='[Write Only]';
end
if strcmp(class(str),'Simulink.ModelWorkspace')
str='[Simulink.ModelWorkspace]';
elseif strcmp(class(str),'Simulink.SlDomainInfoRegistry')
str='[Simulink.SlDomainInfoRegistry]';
elseif isempty(str)
str='''''';
elseif iscell(str)
str='[Cell]';
elseif isstruct(str)
str='[Struct]';
elseif isnumeric(str)
if size(str,1)==1
str=num2str(str);
else
str='[Matrix]';
end
elseif any(findstr(str,char(10)))
ind=findstr(str,char(10));
str=[str(1:ind(1)-1) ' ...'];
elseif isstr(str)
str=['',str,''];
end
fprintf('%50s: %s \n',fn{ifn},str)
end
else
out=get_param(varargin{1},varargin{2});
end
|
|
Contact us at files@mathworks.com