separating non empty array
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i'm noob to matlab, I have a matrix of 1764 x1 this was concatenated from 2 images how can i create a new matrix where it will automatically split into 2 columns of 882 x2?
example
b=[b;c] % this give me 1764 x 1
i tried
c=[c,b] but it will only give me 882 x1 double instead of 882 x 2
any expert advise is greatly appreciated.
2 Commenti
per isakson
il 5 Set 2014
Modificato: per isakson
il 5 Set 2014
You are using the letters a, b and c in a confusing way! Is a in the second line the same as a in the first?
Risposte (2)
dpb
il 5 Set 2014
a=[b c];
The ';' caused vertical concatenation; a ',' or space is horizontal. Read the "Getting Started" section on basic manipulations in Matlab...
There's a tutorial link on 'Matrices and Arrays' under which is another link specifically on 'Concatenation'. I urge you to just begin at the beginning and work thru the tutorial info to get a handle on the basics...it'll be much quicker route than posting and waiting...
1 Commento
per isakson
il 5 Set 2014
Modificato: per isakson
il 5 Set 2014
"what i'm trying to do now is to split this 1764 x 1 into 884 x 2 double"
This does it
long_vector = linspace( 1, 12, 1764 ); % sample vector
two_row_array = reshape( long_vector, [], 2 );
and check the result
>> whos
Name Size Bytes Class Attributes
long_vector 1x1764 14112 double
two_row_array 882x2 14112 double
The word "split"  is not a good one to describe this operation. And don't forget dpb's advise regarding Getting Started.
 
Correction
The name, two_row_array, should be two_col_array
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!