Location: cellLib @ 71a79f4273eb / Scripts / getPara.m

Author:
WeiweiAi <wai484@aucklanduni.ac.nz>
Date:
2022-04-22 10:49:38+12:00
Desc:
Remove interactive labeling; Specify index when using intersect to avoid order errors add buildComponents.m to wrap multiple building processes;
Permanent Source URI:
https://models.cellml.org/workspace/6bc/rawfile/71a79f4273ebfe232057a071766138694777ab84/Scripts/getPara.m

function comp=getPara(comp,idx)
vars=extractfield(comp,'vars');
all_vars=[];
for i=1: length(vars)
    all_vars=[all_vars;vars{1,i}];
end
% get all non-repetitive parameters
indexp=all_vars(:,idx.vctg)=="para";
pvars=all_vars(indexp,:);
[~,ip,~]=unique(pvars(:,idx.var)','stable');
comp_para.name='Para';
comp_para.children='';
vars_para=pvars(ip,:);
values=vars_para(:,idx.val);
vars_para(:,idx.pub)='out';
vars_para(:,idx.priv)='none';
vars_para(:,idx.init)=values;
comp_para.vars=vars_para;
comp=[comp,comp_para];
end