Error in For Loop
2 次查看(过去 30 天)
显示 更早的评论
Hi everybody,
I have code given below, num is a 1500x3 sized matrix and it has class labels in its third column and number of the classes labels are change according to the input value . I want to keep each line in the class matrix in certain places by class number like Class 1 will be held between 1 and 400 lines,Class 2 will be held between 401 and 790 lines etc. but code gicen below always writes the values same lines
clc; clear all;
[num,txt,raw] = xlsread('data-1.xlsx');
k = input ('Enter a k value:');
for d =1:k ;
lclass = length(num(num(:,3)==d,1:2));
a(d+1) = lclass;
class(:,1:2) = [num(num(:,3)==d,1:2)];
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!