vectorization of (tic toc in for loop)
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 17 de Abr. de 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
el 22 de Abr. de 2014
Respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!