vectorization of (tic toc in for loop)
이전 댓글 표시
A=rand(1000,1000,5);
B=rand(1000,1);
m=0;
i=1:5;
tic;
X=zeros(1000,size(A,3));
X(:,size(A,3))=A(:,:,size(A,3))\B;
m(i)=toc;
m
Mean=mean(m)
Var=var(m)
Std=std(m)
Mode=mode(m)
Min=min(m)
Max=max(m)
Is this the vectorization that without for loop? The toc are same for each repetition. How should I do to get different toc each time the answer for mean, mode, min, max are equal. How should I modified the t/ic toc without loop
댓글 수: 2
Walter Roberson
2014년 4월 17일
Modify it for what purpose?
Your code does exactly the same thing in each loop iteration, so differences in timing would be expected to be small provided that your operating system is not interrupting for some other task. What is it that you would like to vectorize ?
jessey chong
2014년 4월 22일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!