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:
Converting an Image array to Vector or Matrix

Subject: Converting an Image array to Vector or Matrix

From: Nehal

Date: 5 Aug, 2010 17:20:22

Message: 1 of 3

I have an image array. I want to convert the elements into matrix or vector. The matrix will have only 1 column and the number of row will be equal to the number of elements of that image.

For example:
if the binaryImage array has some values like this....
 
imageArray = 1 2 3
                    4 5 6
                    7 8 9

I want to convert the imageArray into a matrix like...

v= [1
      2
      3
      4
      5
      6
      7
      8
      9]

Can anyone help me..? plz..

Subject: Converting an Image array to Vector or Matrix

From: Joseph

Date: 5 Aug, 2010 17:31:08

Message: 2 of 3

Nehal,
imageArray = reshape(imageArray',9,1);

note: I transposed the matrix pre-reshaping it.



"Nehal " <arnab620@yahoo.com> wrote in message <i3ersm$pkr$1@fred.mathworks.com>...
> I have an image array. I want to convert the elements into matrix or vector. The matrix will have only 1 column and the number of row will be equal to the number of elements of that image.
>
> For example:
> if the binaryImage array has some values like this....
>
> imageArray = 1 2 3
> 4 5 6
> 7 8 9
>
> I want to convert the imageArray into a matrix like...
>
> v= [1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9]
>
> Can anyone help me..? plz..

Subject: Converting an Image array to Vector or Matrix

From: Nehal

Date: 5 Aug, 2010 17:55:24

Message: 3 of 3

"Joseph " <don'twannapostit@nopers.com> wrote in message <i3esgs$6r7$1@fred.mathworks.com>...
> Nehal,
> imageArray = reshape(imageArray',9,1);
>
> note: I transposed the matrix pre-reshaping it.
>
>
>
> "Nehal " <arnab620@yahoo.com> wrote in message <i3ersm$pkr$1@fred.mathworks.com>...
> > I have an image array. I want to convert the elements into matrix or vector. The matrix will have only 1 column and the number of row will be equal to the number of elements of that image.
> >
> > For example:
> > if the binaryImage array has some values like this....
> >
> > imageArray = 1 2 3
> > 4 5 6
> > 7 8 9
> >
> > I want to convert the imageArray into a matrix like...
> >
> > v= [1
> > 2
> > 3
> > 4
> > 5
> > 6
> > 7
> > 8
> > 9]
> >
> > Can anyone help me..? plz..

Thank You.
I got it... :)

Tags for this Thread

No tags are associated with 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