I need this section of my code to work faster since it is called many times. I'm new to Matlab, and it seems to me that there MUST be a way to do this, which is not so cool. Any help you could give on how to improve the speed of what I have or other functions to see will help me complete this task.
(The task is to get only the rows “alldata”, where the first column is in the set of “minute intervals” in “alldataMinutes”. “Minintervals” is the minimum value of the column “alldata”, increasing by twenty maximum alldata.
minuteintervals= min(alldata(:,1)):20:max(alldata(:,1)); %20 second intervals
alldataMinutes= zeros(30000,4);
counter=1;
for x=1:length(alldata)
if ismember(alldata(x,1), minuteintervals)
alldataMinutes(counter,:)= alldata(x,:);
counter= counter+1;
end
end
alldataMinutes(counter:length(alldataMinutes),:)= [];
source
share