Got Questions? Get Answers.
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:
storing row vectors in a matrix

Subject: storing row vectors in a matrix

From: Prateek

Date: 4 Feb, 2013 07:07:07

Message: 1 of 5

i want to read an image apply a function to it and convert the resulting matrix into a row vector and store the result in a matrix and i need to do the whole process 26 times for 26 different images
for eg i have image of 100x100 for which i have a user defined function which processes it and i have converted this 100x100 matrix in to a 1x10000 vector now i want to store it into a matrix and 25 other similar to it the result should be a matrix of 26x10000 dimensions
please help me to store these row vectors(1x10000) in to a matrix(26x10000)

Subject: storing row vectors in a matrix

From: Barry Shaw

Date: 4 Feb, 2013 08:50:08

Message: 2 of 5


>> for i = 1 : 26
image_vector = rand(100,100);
transformed_image_vector = reshape(image_vector,1,10000); % your user-defined function.
all_vectors(i,:) = transformed_image_vector;
end

Barry

"Prateek " <malikprateek22@gmail.com> wrote in message <kenmmr$rfu$1@newscl01ah.mathworks.com>...
> i want to read an image apply a function to it and convert the resulting matrix into a row vector and store the result in a matrix and i need to do the whole process 26 times for 26 different images
> for eg i have image of 100x100 for which i have a user defined function which processes it and i have converted this 100x100 matrix in to a 1x10000 vector now i want to store it into a matrix and 25 other similar to it the result should be a matrix of 26x10000 dimensions
> please help me to store these row vectors(1x10000) in to a matrix(26x10000)

Subject: storing row vectors in a matrix

From: Prateek

Date: 4 Feb, 2013 14:51:07

Message: 3 of 5

"Barry Shaw" <Barry@h.com> wrote in message <kenso0$ilb$1@newscl01ah.mathworks.com>...
>
> >> for i = 1 : 26
> image_vector = rand(100,100);
> transformed_image_vector = reshape(image_vector,1,10000); % your user-defined function.
> all_vectors(i,:) = transformed_image_vector;
> end
>
> Barry
>
>hey Barry i have been doing the same but the result is not as expected what it does is store the 26th image in all the rows

Subject: storing row vectors in a matrix

From: Barry Shaw

Date: 5 Feb, 2013 09:46:07

Message: 4 of 5

Post your code.

Are you forgetting to put in the 'i' (my code below) when assigning it to your matrix?

"Prateek " <malikprateek22@gmail.com> wrote in message <keohsr$69h$1@newscl01ah.mathworks.com>...
> "Barry Shaw" <Barry@h.com> wrote in message <kenso0$ilb$1@newscl01ah.mathworks.com>...
> >
> > >> for i = 1 : 26
> > image_vector = rand(100,100);
> > transformed_image_vector = reshape(image_vector,1,10000); % your user-defined function.
> > all_vectors(i,:) = transformed_image_vector;
> > end
> >
> > Barry
> >
> >hey Barry i have been doing the same but the result is not as expected what it does is store the 26th image in all the rows

Subject: storing row vectors in a matrix

From: Barbara

Date: 31 Oct, 2013 16:03:06

Message: 5 of 5

"Barry Shaw" <Barry@h.com> wrote in message <keqkcv$gge$1@newscl01ah.mathworks.com>...
> Post your code.
>
> Are you forgetting to put in the 'i' (my code below) when assigning it to your matrix?
>
> "Prateek " <malikprateek22@gmail.com> wrote in message <keohsr$69h$1@newscl01ah.mathworks.com>...
> > "Barry Shaw" <Barry@h.com> wrote in message <kenso0$ilb$1@newscl01ah.mathworks.com>...
> > >
> > > >> for i = 1 : 26
> > > image_vector = rand(100,100);
> > > transformed_image_vector = reshape(image_vector,1,10000); % your user-defined function.
> > > all_vectors(i,:) = transformed_image_vector;
> > > end
> > >
> > > Barry
> > >
> > >hey Barry i have been doing the same but the result is not as expected what it does is store the 26th image in all the rows


Hello
I have the same problem, there is only one row stored.
There must something else be wrong...

The error message: Subscripted assignment dimension mismatch.

Barbara

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