Matlab: Code Performance Issue Using "ismember" -


I need this section of my code so that it can run as fast as it is called multiple times for the Matlab I am new and I feel like there should be a way to do this that is not so-it's not like-with almost any help you can see what speed I have or improve the speed of other tasks, I will help in doing this work.

(The task is to get only the rows of "alattata" where the first column is in the set of "minute internals" in the column "AlumniIntets." MinimumWalds only increases the minimum value of the "AllData" column twenty Maximum altaata from.

  minute internals = minutes (alattata (,, 1)): 20: max (alattata (, 1));% 20 second interval alldataMinutes = zeros (30000,4 ); For counter = 1; x = 1: length (aldatta) if member (alattata (x, 1), Null internals) aldatiminutes (counter, =) = allaldata (x, :); counter = counter + 1; end end alldataMinutes (counter: length (alldataMinutes), :) = [];  

This should give you what you need, and it should be very fast:

  Minute intervals = minute (alattata (,, 1)): 20: max (alattata (,, 1));% # interval set index = ismember (alldata (,, 1), minute internal);% # in the logical index set First% showing the column value LldataMi Nutes = alldata (index, :); This works by passing the  vector  of the values ​​in the Remove  

function

, instead of passing the values ​​at once, the output index A vector is the same size as alldata (:, 1) , with the value of 1 for the elements of alldata (:,) 1) are set in minute internavalds , and the value of 0 (i.e. wrong) otherwise you can easily rows them in the index Can use Ikalne of them alldataMinutes .


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -