MATLAB: Hi all! Is there a way to initialize row vectors like this:

initializing row vectors

R1= x1; G1= x2; B1= x3; R2= x4; G2= x5; B2= x6; R3= x7; G3= x8; B3= x9; And so on Please help!

Best Answer

"No, it's a single row vector."
Based on this I will assume that R,G and B are also row vectors.
Say,
x=1:30
You can divide elements in x as
R=x(1:3:end-2);
G=x(2:3:end-1);
B=x(3:3:end);
This will give you R, G, B as row vectors with elements from x.