vectorization of (tic toc in for loop)
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 17 Avr 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
le 22 Avr 2014
Réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!