1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| % --- Executes on button press in simul_button.
function simul_button_Callback(hObject, eventdata, handles)
% hObject handle to simul_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
answer=questdlg('Voulez-vous lancer la simulation avec les paramètres actuels?',...
'Lancer simulation','Oui','Non','Non');
if strcmp(answer,'Oui')
h1=handles.uitable1;
S1new=get(h1,'Data');
l1=length(S1new);
%S1new=char(S1new);
mod='mon_modele/';
for i=1:l1
chem=strcat(mod,char(S1new(i,1)));
set_param(chem,'value',char(S1new(i,2)));
end
simout=sim('mon_modele','SrcWorkspace','current');
results=transpose(simout.get('yout'));
setappdata(gcf,'Resultats',results);
l2=length(results);
S2res=cellstr(num2str(results));
S2new=getappdata(gcbf,'Tableau_sorties');
for i=1:l2
S2new{i,2}=S2res{i,1};
end
h2=handles.uitable2;
set(h2,'Data',S2new);
end |
Partager