row filtering and pre-allocate
1 次查看(过去 30 天)
显示 更早的评论
hi all,
here p is (1,3) vector,:
- how can I preallocate a.
- how can store each filtered rows in a seperate matrix.
Regards
for i=1:length(L);
a=p(p(:,3)==L(i),:);
end
0 个评论
采纳的回答
madhan ravi
2020-6-10
编辑:madhan ravi
2020-6-10
a = cell(numel(L),1);
for ii = 1:numel(L);
a{ii} = p(p(:,3) == L(ii),:);
end
celldisp(a)
%or
a = num2cell(p(any(p(:,3) == L, 2), :),2)
2 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!