MATLAB: Error in writing image to folder

imwritesaveas

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
try
x=rgb2gray(x);%image toolbox dependent
catch
x=sum(double(x),3)/3;%if no image toolbox do simple sum
end
end
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
plotbox(output,[],3)
strtemp=strcat('C:\newframes9\',int2str(k),'.',pickind);
saveas(f, 'strtemp', 'bmp' )
end
I have 10 images,i want to write plotted result into folder

Best Answer

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