row filtering and pre-allocate

1 visualización (últimos 30 días)
Oday Shahadh
Oday Shahadh el 10 de Jun. de 2020
Comentada: madhan ravi el 10 de Jun. de 2020
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

Respuesta aceptada

madhan ravi
madhan ravi el 10 de Jun. de 2020
Editada: madhan ravi el 10 de Jun. de 2020
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 comentarios
Oday Shahadh
Oday Shahadh el 10 de Jun. de 2020
how can I edit each matrix, typed a(1) showed just its size
a(1)
ans =
[185x3 double]

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by