Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to merge the matrices in one matrice?

조회 수: 3 (최근 30일)
Ararat Cetinkaya
Ararat Cetinkaya 2020년 3월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
I want to merge class matrix in one matrix in for loop but it gives error like Unrecognized function or variable 'allclass'.
for d =1:3 ;
class(:,1:3) = [num(num(:,3)==d,1:3)];
allclass= [allclass ; class];
end
  댓글 수: 1
David Hill
David Hill 2020년 3월 8일
An example with your data would be helpful. Look at reshape() function.

답변 (1개)

Chidvi Modala
Chidvi Modala 2020년 3월 11일
"Unrecognized function or variable 'allclass'" error may occur because allclass variable is not initialized before using it. So, you can initialize "allclass" variable with an empty array. You can make use of the following example
num = [3 2 1;2 2 2; 1 2 3];
allclass = [];
for d =1:3 ;
temp = num(num(:,3)==d,1:3);
allclass= [allclass ; temp];
end

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by