Why, after compiling the program, the graphics are not saved in the selected folder?
1 回表示 (過去 30 日間)
古いコメントを表示
Так что нарисуйте диаграмму из таблицы данных
функция pushbutton7_Callback (hObject, eventdata, дескрипторы)
глобальные N2s;
глобальные N3s;
глобальный Dpr2;
глобальный Dmin2;
глобальный D3m;
глобальный D3;
глобальный а;
глобальный б;
глобальный с;
глобальный d;
глобальный е;
глобальный f;
глобальный г;
глобальный х;
глобальный у;
глобальный р;
а = N3s;
B = N2s;
с = Dmin2;
д = DPR2;
е = D3M;
F = D3;
х = [0 бб 0];
у = [ccdd];
% лестницы (у, х)
r = [0 aa 0];
р = [Eeff];
% лестницы (р, г)
plot (handles.axes2, y, x, p, r);
title (handles.axes2, 'Зависимое количество СН от дальности до цели' )
xlabel (handles.axes2, 'Дальность, км' );
ylabel (handles.axes2, 'Количество СН' );
Так что сохраните график
Функция uipushtool3_ClickedCallback (hObject, eventdata, дескрипторы)
[filename, pathname, indx] = uiputfile ( 'Зав. количество СН от дальности rez_1.jpeg' );
path_file = FullFile (путь, имя файла)
fid = fopen (path_file, 'w' );
если фид == -1
ошибка ( «Файл не открыт» );
конец
figure_image = getframe (handles.axes2);
imwrite (chart_image.CData, 'Зав. количество СН от дальности rez_1.jpeg' , 'jpeg' );
3 件のコメント
Michael Madelaire
2018 年 12 月 30 日
It is hard to follow when it is not in English, but is there any reason why you are not using saveas(fig, filename)?
採用された回答
Image Analyst
2018 年 12 月 30 日
You, for some reason, have called fopen(). So the file is open and locked when you try to call imwrite(). Therefore imwrite() will fail. You do not need to call fopen(). Don't do that.
Try this:
[baseFileName, folder] = uiputfile ( 'Зав. количество СН от дальности rez_1.jpeg' );
fullFileName = fullfile (folder, baseFileName)
saveas (handles.axes2, fullFileName);
5 件のコメント
Walter Roberson
2019 年 1 月 1 日
When passed an axes, export_fig creates a new figure without menus and so on, and copies the given axes into the figure, and then saves the figure (because there are direct operations for saving figures.) This used to be required. Recently saveas() was improved to be able to save an axes directly.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!