Save- path for image using the function "imwrite()"

32 views (last 30 days)
when I use the imshow() function, I know that I have the image that I want to display in one of the files in the *MATLAB path.
For instance, when I take a picture with my webcam, I want to save it by using imwrite.
where has the image been written to?
Matar Maoz

Accepted Answer

Walter Roberson
Walter Roberson on 13 Feb 2011
The image gets written to the current directory by default. You can specify an explicit path when you imwrite()
Walter Roberson
Walter Roberson on 14 Feb 2011
Sounds like you may have switched directories between.

Sign in to comment.

More Answers (1)

Jan on 13 Feb 2011
IMWRITE writes to the current folder, so these two commands are equivalent:
image = rand(100, 100, 3);
imwrite(image, 'File.png')
imwrite(image, fullfile(cd, 'File.png'))
The later method can be used to specifiy the wanted directory.
Walter Roberson
Walter Roberson on 21 Jul 2016
if ~isempty(R) && ndims(R) < 4 && (isnumeric(R) || islogical(R))
disp('R contains an image');
Or did you mean that R contains the name of a file that contains an image?
if exist(R, 'file')
%if we got here then R does name an image. So for some reason now we are supposed to display a different image
%R names a file that is not an image
%R does not name a file

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by