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

Thread Subject:
more non-singleton rhs dimensions than non-singleton?

Subject: more non-singleton rhs dimensions than non-singleton?

From: Jimmy

Date: 8 Mar, 2010 00:13:05

Message: 1 of 10

     Hi all,

I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
subscripts. The code is:

fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
path=fullfile(fileFolder,'data*.tif');
dirOutput = dir(path);
fileNames ={dirOutput.name};
numFrames = numel(fileNames);
I = imread(fullfile(fileFolder,fileNames{+1}));
rmax=size(I,1);
cmax=size(I,2);

sequence = zeros([size(I,1) size(I,2) numFrames], class(I));

% load in array

for p = 1:numFrames
  sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
end

mov = avifile('test.avi','Compression','None','fps',8);

for j=1:size(sequence,3)
    imshow(sequence(:,:,j));
    f=getframe;
    mov = addframe(mov, f);
end

mov = close(mov);
close all;

The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));

     Does anyone have any idea?

      Thank you
       Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Sadik

Date: 8 Mar, 2010 00:52:08

Message: 2 of 10

Please check the dimensions of I by typing

size(I) %without a semicolon or any other input, just size(I)

If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.

Best.

"Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> Hi all,
>
> I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> subscripts. The code is:
>
> fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> path=fullfile(fileFolder,'data*.tif');
> dirOutput = dir(path);
> fileNames ={dirOutput.name};
> numFrames = numel(fileNames);
> I = imread(fullfile(fileFolder,fileNames{+1}));
> rmax=size(I,1);
> cmax=size(I,2);
>
> sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
>
> % load in array
>
> for p = 1:numFrames
> sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> end
>
> mov = avifile('test.avi','Compression','None','fps',8);
>
> for j=1:size(sequence,3)
> imshow(sequence(:,:,j));
> f=getframe;
> mov = addframe(mov, f);
> end
>
> mov = close(mov);
> close all;
>
> The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
>
> Does anyone have any idea?
>
> Thank you
> Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Jimmy

Date: 8 Mar, 2010 01:09:05

Message: 3 of 10

"Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> Please check the dimensions of I by typing
>
> size(I) %without a semicolon or any other input, just size(I)
>
> If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
>
> Best.
>
> "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > Hi all,
> >
> > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > subscripts. The code is:
> >
> > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > path=fullfile(fileFolder,'data*.tif');
> > dirOutput = dir(path);
> > fileNames ={dirOutput.name};
> > numFrames = numel(fileNames);
> > I = imread(fullfile(fileFolder,fileNames{+1}));
> > rmax=size(I,1);
> > cmax=size(I,2);
> >
> > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> >
> > % load in array
> >
> > for p = 1:numFrames
> > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > end
> >
> > mov = avifile('test.avi','Compression','None','fps',8);
> >
> > for j=1:size(sequence,3)
> > imshow(sequence(:,:,j));
> > f=getframe;
> > mov = addframe(mov, f);
> > end
> >
> > mov = close(mov);
> > close all;
> >
> > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> >
> > Does anyone have any idea?
> >
> > Thank you
> > Jimmy

>> Hi Sadik,
thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
I changed it to [sequence(:,:,:,p)] but I have another error saying:
      Subscripted assignment dimension mismatch

       Thanks
       Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Sadik

Date: 8 Mar, 2010 01:12:06

Message: 4 of 10

Oh, I put the square brackets for explanation only, as in:

... apple [which is a delicious fruit] ...

Sorry for the confusion.

Best.



"Jimmy " <testbest1@yahoo.com> wrote in message <hn1inh$oes$1@fred.mathworks.com>...
> "Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> > Please check the dimensions of I by typing
> >
> > size(I) %without a semicolon or any other input, just size(I)
> >
> > If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
> >
> > Best.
> >
> > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > > Hi all,
> > >
> > > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > > subscripts. The code is:
> > >
> > > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > > path=fullfile(fileFolder,'data*.tif');
> > > dirOutput = dir(path);
> > > fileNames ={dirOutput.name};
> > > numFrames = numel(fileNames);
> > > I = imread(fullfile(fileFolder,fileNames{+1}));
> > > rmax=size(I,1);
> > > cmax=size(I,2);
> > >
> > > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> > >
> > > % load in array
> > >
> > > for p = 1:numFrames
> > > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > end
> > >
> > > mov = avifile('test.avi','Compression','None','fps',8);
> > >
> > > for j=1:size(sequence,3)
> > > imshow(sequence(:,:,j));
> > > f=getframe;
> > > mov = addframe(mov, f);
> > > end
> > >
> > > mov = close(mov);
> > > close all;
> > >
> > > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > >
> > > Does anyone have any idea?
> > >
> > > Thank you
> > > Jimmy
>
> >> Hi Sadik,
> thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
> I changed it to [sequence(:,:,:,p)] but I have another error saying:
> Subscripted assignment dimension mismatch
>
> Thanks
> Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Jimmy

Date: 8 Mar, 2010 01:23:05

Message: 5 of 10

> Yeh, I tried it without brackets but still same error. May be I need to change something else in the code as well?

      Thanks

"Sadik " <sadik.hava@gmail.com> wrote in message <hn1it6$5qi$1@fred.mathworks.com>...
> Oh, I put the square brackets for explanation only, as in:
>
> ... apple [which is a delicious fruit] ...
>
> Sorry for the confusion.
>
> Best.
>
>
>
> "Jimmy " <testbest1@yahoo.com> wrote in message <hn1inh$oes$1@fred.mathworks.com>...
> > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> > > Please check the dimensions of I by typing
> > >
> > > size(I) %without a semicolon or any other input, just size(I)
> > >
> > > If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
> > >
> > > Best.
> > >
> > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > > > Hi all,
> > > >
> > > > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > > > subscripts. The code is:
> > > >
> > > > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > > > path=fullfile(fileFolder,'data*.tif');
> > > > dirOutput = dir(path);
> > > > fileNames ={dirOutput.name};
> > > > numFrames = numel(fileNames);
> > > > I = imread(fullfile(fileFolder,fileNames{+1}));
> > > > rmax=size(I,1);
> > > > cmax=size(I,2);
> > > >
> > > > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> > > >
> > > > % load in array
> > > >
> > > > for p = 1:numFrames
> > > > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > end
> > > >
> > > > mov = avifile('test.avi','Compression','None','fps',8);
> > > >
> > > > for j=1:size(sequence,3)
> > > > imshow(sequence(:,:,j));
> > > > f=getframe;
> > > > mov = addframe(mov, f);
> > > > end
> > > >
> > > > mov = close(mov);
> > > > close all;
> > > >
> > > > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > >
> > > > Does anyone have any idea?
> > > >
> > > > Thank you
> > > > Jimmy
> >
> > >> Hi Sadik,
> > thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
> > I changed it to [sequence(:,:,:,p)] but I have another error saying:
> > Subscripted assignment dimension mismatch
> >
> > Thanks
> > Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Jimmy

Date: 8 Mar, 2010 01:27:06

Message: 6 of 10

> Yeh, I tried it without brackets but still same error. May be I need to change something else in the code as well?

      Thanks

"Sadik " <sadik.hava@gmail.com> wrote in message <hn1it6$5qi$1@fred.mathworks.com>...
> Oh, I put the square brackets for explanation only, as in:
>
> ... apple [which is a delicious fruit] ...
>
> Sorry for the confusion.
>
> Best.
>
>
>
> "Jimmy " <testbest1@yahoo.com> wrote in message <hn1inh$oes$1@fred.mathworks.com>...
> > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> > > Please check the dimensions of I by typing
> > >
> > > size(I) %without a semicolon or any other input, just size(I)
> > >
> > > If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
> > >
> > > Best.
> > >
> > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > > > Hi all,
> > > >
> > > > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > > > subscripts. The code is:
> > > >
> > > > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > > > path=fullfile(fileFolder,'data*.tif');
> > > > dirOutput = dir(path);
> > > > fileNames ={dirOutput.name};
> > > > numFrames = numel(fileNames);
> > > > I = imread(fullfile(fileFolder,fileNames{+1}));
> > > > rmax=size(I,1);
> > > > cmax=size(I,2);
> > > >
> > > > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> > > >
> > > > % load in array
> > > >
> > > > for p = 1:numFrames
> > > > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > end
> > > >
> > > > mov = avifile('test.avi','Compression','None','fps',8);
> > > >
> > > > for j=1:size(sequence,3)
> > > > imshow(sequence(:,:,j));
> > > > f=getframe;
> > > > mov = addframe(mov, f);
> > > > end
> > > >
> > > > mov = close(mov);
> > > > close all;
> > > >
> > > > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > >
> > > > Does anyone have any idea?
> > > >
> > > > Thank you
> > > > Jimmy
> >
> > >> Hi Sadik,
> > thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
> > I changed it to [sequence(:,:,:,p)] but I have another error saying:
> > Subscripted assignment dimension mismatch
> >
> > Thanks
> > Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Sadik

Date: 8 Mar, 2010 01:33:05

Message: 7 of 10

You can easily solve the problem this way:

1. Please check if you have modified the following for loop:

for j=1:size(sequence,3)
 ....

Here, it must be j = 1:size(sequence,4)

2. In the Command Window, type

dbstop if error

This will stop right at the line of error. There, you will have the chance to check the dimensions of both sides. Once it gives the error and stops, you will see the following in the command window:

K>>

This is where you can go ahead and use keyboard input. Once you get to this point, please check the following two:

a) size(sequence(:,:,:,p))
b) size(imread(fullfile(fileFolder,fileNames{p})))

This should give you lots of insight as to what is causing the error.

Best.


"Jimmy " <testbest1@yahoo.com> wrote in message <hn1jhp$f4i$1@fred.mathworks.com>...
> > Yeh, I tried it without brackets but still same error. May be I need to change something else in the code as well?
>
> Thanks
>
> "Sadik " <sadik.hava@gmail.com> wrote in message <hn1it6$5qi$1@fred.mathworks.com>...
> > Oh, I put the square brackets for explanation only, as in:
> >
> > ... apple [which is a delicious fruit] ...
> >
> > Sorry for the confusion.
> >
> > Best.
> >
> >
> >
> > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1inh$oes$1@fred.mathworks.com>...
> > > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> > > > Please check the dimensions of I by typing
> > > >
> > > > size(I) %without a semicolon or any other input, just size(I)
> > > >
> > > > If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
> > > >
> > > > Best.
> > > >
> > > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > > > > Hi all,
> > > > >
> > > > > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > > > > subscripts. The code is:
> > > > >
> > > > > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > > > > path=fullfile(fileFolder,'data*.tif');
> > > > > dirOutput = dir(path);
> > > > > fileNames ={dirOutput.name};
> > > > > numFrames = numel(fileNames);
> > > > > I = imread(fullfile(fileFolder,fileNames{+1}));
> > > > > rmax=size(I,1);
> > > > > cmax=size(I,2);
> > > > >
> > > > > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> > > > >
> > > > > % load in array
> > > > >
> > > > > for p = 1:numFrames
> > > > > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > > end
> > > > >
> > > > > mov = avifile('test.avi','Compression','None','fps',8);
> > > > >
> > > > > for j=1:size(sequence,3)
> > > > > imshow(sequence(:,:,j));
> > > > > f=getframe;
> > > > > mov = addframe(mov, f);
> > > > > end
> > > > >
> > > > > mov = close(mov);
> > > > > close all;
> > > > >
> > > > > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > >
> > > > > Does anyone have any idea?
> > > > >
> > > > > Thank you
> > > > > Jimmy
> > >
> > > >> Hi Sadik,
> > > thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
> > > I changed it to [sequence(:,:,:,p)] but I have another error saying:
> > > Subscripted assignment dimension mismatch
> > >
> > > Thanks
> > > Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Jimmy

Date: 8 Mar, 2010 01:48:05

Message: 8 of 10

>> Ok I did that, it says that error is in:
 sequence(:,:,:,p) = imread(fullfile(fileFolder,fileNames{p}));

I checked a) and b) and it's :
a) size(sequence(:,:,:,p)) - 220 220 99
b) size(imread(fullfile(fileFolder,fileNames{p}))) - 220 220 3

    Not too sure what's the problem

"Sadik " <sadik.hava@gmail.com> wrote in message <hn1k4h$l8b$1@fred.mathworks.com>...
> You can easily solve the problem this way:
>
> 1. Please check if you have modified the following for loop:
>
> for j=1:size(sequence,3)
> ....
>
> Here, it must be j = 1:size(sequence,4)
>
> 2. In the Command Window, type
>
> dbstop if error
>
> This will stop right at the line of error. There, you will have the chance to check the dimensions of both sides. Once it gives the error and stops, you will see the following in the command window:
>
> K>>
>
> This is where you can go ahead and use keyboard input. Once you get to this point, please check the following two:
>
> a) size(sequence(:,:,:,p))
> b) size(imread(fullfile(fileFolder,fileNames{p})))
>
> This should give you lots of insight as to what is causing the error.
>
> Best.
>
>
> "Jimmy " <testbest1@yahoo.com> wrote in message <hn1jhp$f4i$1@fred.mathworks.com>...
> > > Yeh, I tried it without brackets but still same error. May be I need to change something else in the code as well?
> >
> > Thanks
> >
> > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1it6$5qi$1@fred.mathworks.com>...
> > > Oh, I put the square brackets for explanation only, as in:
> > >
> > > ... apple [which is a delicious fruit] ...
> > >
> > > Sorry for the confusion.
> > >
> > > Best.
> > >
> > >
> > >
> > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1inh$oes$1@fred.mathworks.com>...
> > > > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> > > > > Please check the dimensions of I by typing
> > > > >
> > > > > size(I) %without a semicolon or any other input, just size(I)
> > > > >
> > > > > If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
> > > > >
> > > > > Best.
> > > > >
> > > > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > > > > > Hi all,
> > > > > >
> > > > > > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > > > > > subscripts. The code is:
> > > > > >
> > > > > > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > > > > > path=fullfile(fileFolder,'data*.tif');
> > > > > > dirOutput = dir(path);
> > > > > > fileNames ={dirOutput.name};
> > > > > > numFrames = numel(fileNames);
> > > > > > I = imread(fullfile(fileFolder,fileNames{+1}));
> > > > > > rmax=size(I,1);
> > > > > > cmax=size(I,2);
> > > > > >
> > > > > > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> > > > > >
> > > > > > % load in array
> > > > > >
> > > > > > for p = 1:numFrames
> > > > > > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > > > end
> > > > > >
> > > > > > mov = avifile('test.avi','Compression','None','fps',8);
> > > > > >
> > > > > > for j=1:size(sequence,3)
> > > > > > imshow(sequence(:,:,j));
> > > > > > f=getframe;
> > > > > > mov = addframe(mov, f);
> > > > > > end
> > > > > >
> > > > > > mov = close(mov);
> > > > > > close all;
> > > > > >
> > > > > > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > > >
> > > > > > Does anyone have any idea?
> > > > > >
> > > > > > Thank you
> > > > > > Jimmy
> > > >
> > > > >> Hi Sadik,
> > > > thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
> > > > I changed it to [sequence(:,:,:,p)] but I have another error saying:
> > > > Subscripted assignment dimension mismatch
> > > >
> > > > Thanks
> > > > Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Sadik

Date: 8 Mar, 2010 01:51:02

Message: 9 of 10

Perhaps it is here:

sequence = zeros([size(I,1) size(I,2) numFrames], class(I));

It should have been:

sequence = zeros([size(I,1) size(I,2) 3 numFrames], class(I));


"Jimmy " <testbest1@yahoo.com> wrote in message <hn1l0l$fuj$1@fred.mathworks.com>...
> >> Ok I did that, it says that error is in:
> sequence(:,:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
>
> I checked a) and b) and it's :
> a) size(sequence(:,:,:,p)) - 220 220 99
> b) size(imread(fullfile(fileFolder,fileNames{p}))) - 220 220 3
>
> Not too sure what's the problem
>
> "Sadik " <sadik.hava@gmail.com> wrote in message <hn1k4h$l8b$1@fred.mathworks.com>...
> > You can easily solve the problem this way:
> >
> > 1. Please check if you have modified the following for loop:
> >
> > for j=1:size(sequence,3)
> > ....
> >
> > Here, it must be j = 1:size(sequence,4)
> >
> > 2. In the Command Window, type
> >
> > dbstop if error
> >
> > This will stop right at the line of error. There, you will have the chance to check the dimensions of both sides. Once it gives the error and stops, you will see the following in the command window:
> >
> > K>>
> >
> > This is where you can go ahead and use keyboard input. Once you get to this point, please check the following two:
> >
> > a) size(sequence(:,:,:,p))
> > b) size(imread(fullfile(fileFolder,fileNames{p})))
> >
> > This should give you lots of insight as to what is causing the error.
> >
> > Best.
> >
> >
> > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1jhp$f4i$1@fred.mathworks.com>...
> > > > Yeh, I tried it without brackets but still same error. May be I need to change something else in the code as well?
> > >
> > > Thanks
> > >
> > > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1it6$5qi$1@fred.mathworks.com>...
> > > > Oh, I put the square brackets for explanation only, as in:
> > > >
> > > > ... apple [which is a delicious fruit] ...
> > > >
> > > > Sorry for the confusion.
> > > >
> > > > Best.
> > > >
> > > >
> > > >
> > > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1inh$oes$1@fred.mathworks.com>...
> > > > > "Sadik " <sadik.hava@gmail.com> wrote in message <hn1hno$nda$1@fred.mathworks.com>...
> > > > > > Please check the dimensions of I by typing
> > > > > >
> > > > > > size(I) %without a semicolon or any other input, just size(I)
> > > > > >
> > > > > > If it is an rgb image that you are reading, it will have 3 dimensions. I think this is why you are getting that error. If you are working with such images, it is a good idea to have a 4D variable [sequence(:,:,:,p)] rather than a 3D one.
> > > > > >
> > > > > > Best.
> > > > > >
> > > > > > "Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> > > > > > > Hi all,
> > > > > > >
> > > > > > > I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> > > > > > > subscripts. The code is:
> > > > > > >
> > > > > > > fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> > > > > > > path=fullfile(fileFolder,'data*.tif');
> > > > > > > dirOutput = dir(path);
> > > > > > > fileNames ={dirOutput.name};
> > > > > > > numFrames = numel(fileNames);
> > > > > > > I = imread(fullfile(fileFolder,fileNames{+1}));
> > > > > > > rmax=size(I,1);
> > > > > > > cmax=size(I,2);
> > > > > > >
> > > > > > > sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
> > > > > > >
> > > > > > > % load in array
> > > > > > >
> > > > > > > for p = 1:numFrames
> > > > > > > sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > > > > end
> > > > > > >
> > > > > > > mov = avifile('test.avi','Compression','None','fps',8);
> > > > > > >
> > > > > > > for j=1:size(sequence,3)
> > > > > > > imshow(sequence(:,:,j));
> > > > > > > f=getframe;
> > > > > > > mov = addframe(mov, f);
> > > > > > > end
> > > > > > >
> > > > > > > mov = close(mov);
> > > > > > > close all;
> > > > > > >
> > > > > > > The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> > > > > > >
> > > > > > > Does anyone have any idea?
> > > > > > >
> > > > > > > Thank you
> > > > > > > Jimmy
> > > > >
> > > > > >> Hi Sadik,
> > > > > thank you for your reply, I checked the dimenssions and I have 3 dimenssions indeed.
> > > > > I changed it to [sequence(:,:,:,p)] but I have another error saying:
> > > > > Subscripted assignment dimension mismatch
> > > > >
> > > > > Thanks
> > > > > Jimmy

Subject: more non-singleton rhs dimensions than non-singleton?

From: Cesar Manuel Diez Chirinos

Date: 1 Jul, 2013 18:18:07

Message: 10 of 10

I found a possible solution, let me know if it works,
replace:
sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
by
sequence(:,:,1:p) = imread(fullfile(fileFolder,fileNames{p}));

my code is similar, but it worked

regards

Cesar

"Jimmy " <testbest1@yahoo.com> wrote in message <hn1feh$18f$1@fred.mathworks.com>...
> Hi all,
>
> I am trying to compile a video from a sequence of images but I am getting the following error: Assignment has more non-singleton rhs dimensions than non-singleton
> subscripts. The code is:
>
> fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
> path=fullfile(fileFolder,'data*.tif');
> dirOutput = dir(path);
> fileNames ={dirOutput.name};
> numFrames = numel(fileNames);
> I = imread(fullfile(fileFolder,fileNames{+1}));
> rmax=size(I,1);
> cmax=size(I,2);
>
> sequence = zeros([size(I,1) size(I,2) numFrames], class(I));
>
> % load in array
>
> for p = 1:numFrames
> sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
> end
>
> mov = avifile('test.avi','Compression','None','fps',8);
>
> for j=1:size(sequence,3)
> imshow(sequence(:,:,j));
> f=getframe;
> mov = addframe(mov, f);
> end
>
> mov = close(mov);
> close all;
>
> The error is in line: sequence(:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
>
> Does anyone have any idea?
>
> Thank you
> Jimmy

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us