row filtering and pre-allocate

조회 수: 1 (최근 30일)
Oday Shahadh
Oday Shahadh 2020년 6월 10일
댓글: madhan ravi 2020년 6월 10일
hi all,
here p is (1,3) vector,:
  1. how can I preallocate a.
  2. how can store each filtered rows in a seperate matrix.
Regards
for i=1:length(L);
a=p(p(:,3)==L(i),:);
end

채택된 답변

madhan ravi
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
Oday Shahadh
Oday Shahadh 2020년 6월 10일
how can I edit each matrix, typed a(1) showed just its size
a(1)
ans =
[185x3 double]

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by