フィルターのクリア

adding labels and automatically saving as .jpg

4 ビュー (過去 30 日間)
Ahmed Abdulla
Ahmed Abdulla 2019 年 6 月 20 日
編集済み: Adam Danz 2019 年 6 月 26 日
i have the following code that draws a scatter graph of values from 2 different matrices i would like to add x and y labels to the figure and automatically save it as .jpg without displaying the figure because it makes my laptop so slow.
figure(2); hold on
for i=1:numel(GRS_Fe_concentration)
plot(GRS_Fe_concentration(i),mag1(i),'*k');
end

採用された回答

Adam Danz
Adam Danz 2019 年 6 月 20 日
編集済み: Adam Danz 2019 年 6 月 26 日
" i would like to add x and y labels to the figure and automatically save it as .jpg without displaying the figure "
You can set the 'Visible' property of the figure to 'off' so that the figure never displays.
fh = figure(2,'Visible','off'); ; %the figure will not display
hold on
for i=1:numel(GRS_Fe_concentration)
plot(GRS_Fe_concentration(i),mag1(i),'*k');
end
xlabel('x axis')
ylabel('y axis')
figName = 'myFigure'; %specify the path, too; use fullfile()
saveas(fh,figName,'jpg');
Note that if you ever save the figure as a 'fig' instead of 'jpg', when you open the figure the visibility will still be set to off and you won't see it. You'll need to search for all figures and set their visibility to 'on'.
set(findall(0,'type','figure'),'Visible','on')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by