フィルターのクリア

how can i express the following question in matlab about save command?

1 回表示 (過去 30 日間)
Konstantinos Sokratous
Konstantinos Sokratous 2019 年 5 月 13 日
回答済み: Stephen23 2019 年 5 月 21 日
Matlab will ask the user if it wants to save it to a file JPEG or PNG image. If so, then it will ask further the user to name the file and save it to the PC respectively
  2 件のコメント
dpb
dpb 2019 年 5 月 13 日
And what are you wanting different, exactly?
Save programmatically w/o user interaction, maybe??? Something else?
We can't answer until we understand the problem.
Konstantinos Sokratous
Konstantinos Sokratous 2019 年 5 月 13 日
The user gives some values and the code creates a plot, the problem is that i dont know how to write a command so matlab asks the user if he wants to save that plot as JPEG or PNG image at the PC, and if yes, then ask again the user to name the file(plot image) and save it on PC.

サインインしてコメントする。

回答 (2 件)

vidhathri bhat
vidhathri bhat 2019 年 5 月 21 日
Take the input from the user as to whether he wants jpeg or png image using if-else statement.
prompt = 'input 1-for jpeg 2-for png ';
x = input(prompt)
filename = input('Enter the filename')
if(x==1)
saveas(fig,filename,'jpeg')
else
saveas(fig,filename,'png')

Stephen23
Stephen23 2019 年 5 月 21 日
Use uiputfile for a more professional user interface, e.g.:
[F,P,X] = uiputfile({'*.jpg';'*.png'});
imwrite(A,fullfile(P,F))

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by