Eliminating a for loop for faster computation
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
HI, FInd below part of my code .Is it possible to substitute the for loop so that it is faster and takes less computation?
time_durations=zeros(length(out),1)';
for k=1:length(out)
time_durations(k)=minutes(time_select_20000(out(k,3))-time_select_20000(out(k,2)));
end
댓글 수: 0
답변 (1개)
Walter Roberson
2015년 6월 26일
Have you tried
minutes(time_select_20000(out(:,3))-time_select_20000(out(:,2)))
with no loop?
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!