More efficient row removal

Hi all,
From subsets of a matrix I want to remove all first columns containing a date value that is 'night'. The matrix is very large (>300000 entries) and I would like to make a faster way.
A{i} -11.238 42.72 11.518 460 777
-11.217 42.72 11.518 464 777
-11.176 42.72 11.518 457 777
-11.133 42.72 11.518 465 777
-11.092 42.72 11.518 463 777
morning=6;
evening=18;
ab = find(morning > hour(A{i}(:,1)) & hour(A{i}(:,1)) >
evening);
[ac,PS] = removerows(A{i},'ind',ab);
disp(ac);
disp(datevec(ac(:,1)));
So this works well, but slow.
Any suggestions?
Kind regards and thanks in advance, Daan

1 comentario

Matt Kindig
Matt Kindig el 10 de Mayo de 2013
Editada: Matt Kindig el 10 de Mayo de 2013
Can you convert A to a numeric matrix (rather than a cell array)? That might help.
Also, do you need the PS output of removerows()? Could you just use elementary matrix operations?
How is 'hour' defined? Is this a matrix or a function?

Respuestas (0)

La pregunta está cerrada.

Preguntada:

el 10 de Mayo de 2013

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by