copy datas, one above the others, in a new matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Aude Rapet
il 20 Nov 2016
Commentato: Aude Rapet
il 20 Nov 2016
Hi! I am a beginner in matlab.
I want to copy the first two columns of my variable cnt in a new variable called o : and my 3rd column = 1 :
[i,j] = size (cnt) ;
o(:,1:2) = cnt(:,1:2) ;
o(:,3) = 1 ;
Then I have new datas from cnt2, and I want to copy the first two columns UNDER the datas I have already copied from cnt : and my 3rd column = 2 for these news datas :
[h,k] = size (cnt2) ;
o(i:i+h,1:2) = cnt2(1:h,1:2) ;
o(i:i+h,3) = 2 ;
I have this error message:
Subscripted assignment dimension mismatch.
Can you help me? Thank you! Aude
0 Commenti
Risposta accettata
the cyclist
il 20 Nov 2016
In place of this ...
o(i:i+h,1:2) = cnt2(1:h,1:2) ;
o(i:i+h,3) = 2 ;
I think you intended this ...
o(i+1:i+h,1:2) = cnt2(1:h,1:2) ;
o(i+1:i+h,3) = 2 ;
Più risposte (0)
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!