Skip to content
Snippets Groups Projects
Commit bf561f7d authored by Cristian Galperti's avatar Cristian Galperti
Browse files

referenced template model inserted into duplicate function

parent cb99e9fb
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -11,6 +11,7 @@ fprintf('Copying files ...\n'); ...@@ -11,6 +11,7 @@ fprintf('Copying files ...\n');
filelist={... filelist={...
'algo_template.slx',... 'algo_template.slx',...
'algo_template_harness.slx',... 'algo_template_harness.slx',...
'algo_template_referenced.slx',...
'algo_template_harness_run.m',... 'algo_template_harness_run.m',...
'algo_template_test.m',... 'algo_template_test.m',...
'algo_template_loadtp.m',... 'algo_template_loadtp.m',...
...@@ -44,19 +45,20 @@ end ...@@ -44,19 +45,20 @@ end
% The way I found to get block diagrams % The way I found to get block diagrams
% programmatically (of opened system) is via: % programmatically (of opened system) is via:
% proplist = find_system % proplist = find_system
% paramstruct get_param(proplist{1},'DialogParameters') % paramstruct = get_param(proplist{1},'DialogParameters')
% and then % and then
% get_param(proplist{1},<paramstruct field> % get_param(proplist{1},<paramstruct field>)
% %
% hence I do not see other option than % hence I do not see other options than
% keeping a list lije this % keeping a list like this
% updated with the template content: % updated (manually ...) with the template content:
fprintf('Changing block diagrams properties ...\n'); fprintf('Changing block diagrams properties ...\n');
list={{'algo_template/realtime' ,'SampleTime'}, ... list={{'algo_template/realtime' ,'SampleTime',}, ...
{'algo_template/signal_in' ,'OutDataTypeStr'}, ... {'algo_template/signal_in' ,'OutDataTypeStr',}, ...
{'algo_template/signal_out' ,'OutDataTypeStr'}, ... {'algo_template/signal_out' ,'OutDataTypeStr',}, ...
{'algo_template/Gain' ,'Gain'}, ... {'algo_template/Gain' ,'Gain'}, ...
{'algo_template/Constant' ,'OutDataTypeStr'}, ... {'algo_template/Constant' ,'OutDataTypeStr'}, ...
{'algo_template/Model' ,'ModelNameDialog'}, ...
}; };
load_system(['algo_' name]); load_system(['algo_' name]);
for i=1:numel(list) for i=1:numel(list)
...@@ -66,6 +68,18 @@ for i=1:numel(list) ...@@ -66,6 +68,18 @@ for i=1:numel(list)
fprintf('changing %s,%s %s->%s\n', parobj,list{i}{2},oldvalue,newvalue); fprintf('changing %s,%s %s->%s\n', parobj,list{i}{2},oldvalue,newvalue);
set_param(parobj,list{i}{2},newvalue); set_param(parobj,list{i}{2},newvalue);
end end
fprintf('Changing referenced subsystem instance parameter ...\n');
list={{'algo_template/Model', 'InstanceParameters'}};
for i=1:numel(list)
parobj=strrep(list{i}{1},'template',name);
oldvalue = get_param(parobj,list{i}{2});
newvalue = oldvalue;
newvalue.Value = sprintf('algo_%s_tp.refmodel',name);
fprintf('changing %s,%s %s->%s\n', parobj,list{i}{2},oldvalue.Value,newvalue.Value);
set_param(parobj,list{i}{2},newvalue);
end
save_system(['algo_' name]); save_system(['algo_' name]);
fprintf('Renaming ''template'' to ''%s'' inside .m files ...\n',name); fprintf('Renaming ''template'' to ''%s'' inside .m files ...\n',name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment