Borrar filtros
Borrar filtros

copy datas, one above the others, in a new matrix

1 visualización (últimos 30 días)
Aude Rapet
Aude Rapet el 20 de Nov. de 2016
Comentada: Aude Rapet el 20 de Nov. de 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

Respuesta aceptada

the cyclist
the cyclist el 20 de Nov. de 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 ;

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by