I wrote a code to clean and print multiple images,
data_1=csvread(data)
for h=1:30
im_old=imread(strcat('catches\image_generator (',int2str(h),').png'));
im_bw=func_bw(im_old);
im_2=func_clean_tr(im_bw);
[im_3a,im_3b]=edge_trial(im_2);
da=data_1{h,2};
name=strcat('trrr\',da,'trial.png');
imwrite(im_3b,strcat('trrr\',int2str(h),'trial.png'));
end
There is a particular problem. The imwrite works when the parameters are:
imwrite(im_3b,strcat('trrr\',int2str(h),'trial.png'));
But it wont work when I give the parameters as:
imwrite(im_3b,strcat('trrr\',da,'trial.png'));
I cross checked that da
is a 1x1 string and strcat('trrr\',da,'trial.png')
is also a 1x1 string.
The error shown is:
Error using imwrite>parse_inputs (line 510)
A filename must be supplied.
No idea why imwrite
is treating two strings differently...
Edit1: my data_1 reads like: 1,X55N3 2,PQZXS 3,HDDS3... Also, value of da=data_1{h,2}; is "X55N3"