vectorization of (tic toc in for loop)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 17 Apr. 2014
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
am 22 Apr. 2014
Antworten (0)
Kategorien
Mehr zu Performance and Memory finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!