I have made a standalone application out of a Simulink model using the Simulink coder. In this model I have a selection of inline parameters that I set using a GUI.
I use an RTP structure and a batch file to push the inline parameters Can I change the size of these inline parameters after building the standalone application via the gui?
example code:
load('default_rtp.mat') % load the checksum for the rtp structure
clear temp[temp{1,1}]=deal(rtp.parameters);rtp=rmfield(rtp,'parameters'); %remove old parameters
values_gui=[handles.var.Ta,handles.var.Voltage,handles.var.cycles,handles.var.displacement,handles.var.load,handles.var.load_prof,handles.var.guess,handles.var.pos_prof,handles.var.prof_select];names_gui={handles.var.Ta,handles.var.Voltage,handles.var.cycles,handles.var.displacement,handles.var.load,handles.var.load_prof,handles.var.guess,handles.var.pos_prof,handles.var.prof_select};temp{1,1}.values=values_gui;rtp.parameters=temp; % push new parameters
clear temp
% where I try to update the dimensions of the signals, this does not work
for i=1:length(rtp.parameters{1,1}.map) rtp.parameters{1,1}.map(i).Dimensions=size(names_gui{i}); if i==1 rtp.parameters{1,1}.map(i).ValueIndices=rtp.parameters{1,1}.map(i).Dimensions; else rtp.parameters{1,1}.map(i).ValueIndices=[rtp.parameters{1,1}.map(i-1).ValueIndices(2)+1,rtp.parameters{1,1}.map(i-1).ValueIndices(2)+size(names_gui{i},2)]; endendsave(prmFileName,'rtp');%create bat
fid = fopen(batFileName, 'w');idx = 1;outMatFile = [mdlName, '_run',num2str(idx),'.mat'];cmd = [exeFileName, ... ' -p ', prmFileName, '@', int2str(idx), ... ' -o ', outMatFile, ... ' -L 3600'];if ispc cmd = [cmd, ' 2>&1>> ', logFileName];else % (unix)
cmd = ['.' filesep cmd, ' 1> ', logFileName, ' 2>&1'];endfprintf(fid, ['echo "', cmd, '"\n']);fprintf(fid, [cmd, '\n']);if isunix, system(['touch ', logFileName]); system(['chmod +x ', batFileName]);endfclose(fid);%start simulation
[stat, res] = system(['.' filesep batFileName]);
Best Answer