Effacer les filtres
Effacer les filtres

Why, after compiling the program, the graphics are not saved in the selected folder?

1 vue (au cours des 30 derniers jours)
Так что нарисуйте диаграмму из таблицы данных
функция 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 commentaires
Michael Madelaire
Michael Madelaire le 30 Déc 2018
It is hard to follow when it is not in English, but is there any reason why you are not using saveas(fig, filename)?
Sabina
Sabina le 30 Déc 2018
With Saveas does not work either

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 30 Déc 2018
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 commentaires
Walter Roberson
Walter Roberson le 1 Jan 2019
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.
Sabina
Sabina le 1 Jan 2019
Thank you, I will try and understand

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by