フィルターのクリア

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

1 回表示 (過去 30 日間)
Aude Rapet
Aude Rapet 2016 年 11 月 20 日
コメント済み: Aude Rapet 2016 年 11 月 20 日
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

採用された回答

the cyclist
the cyclist 2016 年 11 月 20 日
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 ;
  1 件のコメント
Aude Rapet
Aude Rapet 2016 年 11 月 20 日
Oh yes that's it! Thank you very much!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by