How to save an image in a folder automatically?

34 ビュー (過去 30 日間)
ezhil K
ezhil K 2019 年 2 月 5 日
編集済み: Rahul punk 2021 年 6 月 3 日
I need to save the output image into a folder named 'Plate' in path named Documents/MATLAB/Project/Plate. But, I get error if I do so.Can anyone helpme in rectifying it?I have attached my code and the error in it.Anyone please help me in rectifying it.
baseFileName = 'my new image.png'; % Whatever....
fullFileName = fullfile('Documents/MATLAB/Project/Plate', baseFileName);
imwrite(r, fullFileName);
Error is
Error using imwrite (line 474)
Unable to open file "Documents\MATLAB\Project\Plate\my new image.png" for writing. You might not have write permission.
Error in Shi_tomashi (line 134)
imwrite(r, fullFileName);

回答 (3 件)

KSSV
KSSV 2019 年 2 月 5 日
Go the respective folder and check the permissions......you need to give permissions to the folder to write the data into the folder.
  2 件のコメント
ezhil K
ezhil K 2019 年 2 月 5 日
Write permissions are given to that folder.
KSSV
KSSV 2019 年 2 月 5 日
That case what is r?

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


samreen mughal
samreen mughal 2019 年 6 月 18 日
編集済み: samreen mughal 2019 年 6 月 18 日
baseFileName = sprintf('my new image.png'); % Whatever....
fullFileName = fullfile('Documents/MATLAB/Project/Plate', baseFileName);
imwrite(r, fullFileName);
r is your image, right?
if r is the image then,
just include "sprintf" command in your code for writing your file name.

Rahul punk
Rahul punk 2021 年 6 月 2 日
編集済み: Rahul punk 2021 年 6 月 3 日
%read image test.jpg
tt= imshow(image) ;
%save your image other location with any name save desktop or any folder also
saveas(tt,'C:\Users\admin\Desktop\testimagesave.jpg') ;
  1 件のコメント
Rik
Rik 2021 年 6 月 2 日
How does this answer the original question?

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

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by