Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Error in writing image to folder

Asked by kash on 12 Jan 2013

I have a code below in which the image is not writtten into the specified folder please tell where isthe mistake

for k=1:length(TestFiles)
x=imread([FullPath '\' TestFiles(k).name]);
% figure,imshow(S)
if (size(x,3)>1)%if RGB image make gray scale
        x=rgb2gray(x);%image toolbox dependent
        x=sum(double(x),3)/3;%if no image toolbox do simple sum
x=double(x);%make sure the input is double format
[output,count,m,svec]=facefind(x);%full scan 
f = figure, imagesc(x);colormap(gray)%show image
saveas(f, 'strtemp', 'bmp' )

I have 10 images,i want to write plotted result into folder

1 Comment

Jan Simon on 12 Jan 2013

Please explain what happens instead of your expectations. It is much easier to solve a problem, when you do not have to guess at first, what the problem is.



No products are associated with this question.

1 Answer

Answer by Walter Roberson on 12 Jan 2013
Accepted answer


saveas(f, 'strtemp', 'bmp' )


saveas(f, strtemp, 'bmp' )

1 Comment

Jan Simon on 12 Jan 2013

Only the save commands want the variable as string, but saveas wants the variable itself. A strange idea, but I think this decision was made 1984 and it cannot be changed anymore.

Walter Roberson

Contact us