Info
This question is closed. Reopen it to edit or answer.
how to merge the matrices in one matrice?
1 view (last 30 days)
Show older comments
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 Comment
Answers (1)
Chidvi Modala
on 11 Mar 2020
"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
0 Comments
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!