Info

This question is closed. Reopen it to edit or answer.

More efficient row removal

1 view (last 30 days)
Daan
Daan on 10 May 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comment
Matt Kindig
Matt Kindig on 10 May 2013
Edited: Matt Kindig on 10 May 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?

Answers (0)

Community Treasure Hunt

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

Start Hunting!