-3

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.

nkjt
  • 7,825
  • 9
  • 22
  • 28

1 Answers1

0

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);
Daniel
  • 21,933
  • 14
  • 72
  • 101
  • nope that does not work.All the inputs must be two dimensional is the error its showing – user3424964 Apr 10 '14 at 15:37
  • How are you assigning `our_images` ? – Daniel Apr 10 '14 at 15:39
  • our_images = imread(full_name); our_image is the image that we read – user3424964 Apr 10 '14 at 15:39
  • In that case you should not concatenate it in `strcat(our_images,'\',imagename);` , instead you should use something like: `strcat(path_to_images,'/',imagename);` – Daniel Apr 10 '14 at 15:41
  • (I think the answers to shai go in the other comments section) – Daniel Apr 10 '14 at 15:45
  • ..it works @ DWilches!!!!!thanks i made these changes imagename=strcat(int2str(imgIndex), '.jpg'); name=strcat('C:\Users\Newfolder\our_images','/',imagename); %save inside output folder imwrite(rgbBlock, name); – user3424964 Apr 10 '14 at 16:08