title: How to form a vector from RGB matrices
body: <p>I have a problem in constructing a vector from an image. I had used a 512 x 512 colour image and separated the rgb planes. Now i want to convert these three planes into three 1D vectors which should be as given in the following example.</p>
  
  <p>Consider a 4x4x3 matrix. Converting it into RGB planes is easy. Now I need to convert these three planes into 1D vectors as given below</p>
  
  <pre><code>  V=[r1g1b1....r6]
    W=[g6b6r7...g11] 
    X=[b11r12...B16]
  </code></pre>
  
  <p>The program ive written is as follows. I used the reshape function to convert RGB planes into 1D vectors. Now I have trouble in regrouping them into different vectors.</p>
  
  <pre><code> A=imread('C:\Users\Desktop\lena.jpg');
   % Extract the individual red, green, and blue color channels.
   R = A(:, :, 1);
   G = A(:, :, 2);
   B = A(:, :, 3);
  
   R1 = reshape(R.',1,[]);
   G1 = reshape(G.',1,[]);
   B1 = reshape(B.',1,[]);
  </code></pre>
  
  <p>I had converted the 2D matrices R G and B into 1D vectors R1, G1 and B1. Now I just need to create new vectores with all three values.I have no idea how to proceed...Please do help...Thanks in advance.</p>