Question

Below is some code which is showing error

imgIndex = 1;
numPlotsR = size(ca, 1);
numPlotsC = size(ca, 2);
for r = 1 : numPlotsR 
for c = 1 : numPlotsC
rgbBlock=ca{r,c};
imagename=strcat(int2str(imgIndex), '.jpg');
name=strcat((int2str(our_images)),'\',imagename);
imwrite(rgbBlock,'name');   

I am trying to write some image file to folder using imwrite. But the last 3 lines is showing error. I need to save all the images which I have created.

Was it helpful?

Solution

I imagine that our_images is the name of the folder when you want your images, so instead of this:

name=strcat((int2str(our_images)),'\',imagename);

you need this:

name=strcat(our_images,'/',imagename);

Also look out for the backslash in there.

Also your name variable should not be quoted here:

imwrite(rgbBlock,'name');

So instead it should be:

imwrite(rgbBlock, name);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top