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 30 31 32 33 34 35 36 37 38
| function main
fig=figure;
button=uicontrol(fig, ...
'Style', 'pushbutton', ...
'String', 'Save...', ...
'Units','normalized','Position', [0.1 0.75 0.08 0.07], ...
'Callback', @save_courbe);
axes('units','normalized','position',[0.2 0.2 0.5 0.5]);
dx=0.1;
j=1;
for i=0:dx:1
x(j,1)=i;
y(j,1)=sqrt(1- x(j,1)^2);
j=j+1;
end
plot(x,y,'ob');
function save_courbe(src,evt)
Matrice_save=[x'; y'];
formatOut = 'HH_MM_SS_dd_mmm_yyyy';
temp=datestr(now,formatOut);
choice =questdlg('Souhaitez vous enregistrer la matrice ?','Save','Oui','Non','Non');
switch choice
case 'Oui'
[FileName,PathName] = uiputfile('*.txt','Enregistrement de la matrice',['Matrice_',temp]);
if isequal(FileName,0) || isequal(PathName,0)
disp('Matrice non enregistré');
else
fid=fopen(fullfile(PathName,FileName),'wt');
fprintf(fid,'%f %f\n',Matrice_save);
fclose(fid);
disp(['Matrice dans un le fichier : ',FileName]);
end
case 'Non'
disp('Matrice non enregistré');
end
end
end |
Partager