Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Так что нарисуйте диаграмму из таблицы данных
функция 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 comentarios
Michael Madelaire
Michael Madelaire el 30 de Dic. de 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)?

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 30 de Dic. de 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 comentarios
Walter Roberson
Walter Roberson el 1 de En. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by