Prev: FOR loop optimisation
Next: FOR loop optimisation
From: Craig on 11 Jul 2010 22:02 Hi all. I'm just coming to terms with the way MATLAB processes things, and am quickly realising the benefits in the avoidance of looping wherever possible.. I have two set ups I would be ever grateful for assistance with, if possible. I know questions like this are asked all the time, I would also be delighted if someone could point me to a resource to help with this matter. First, I have a simple thing: for i=1:100 ord=0; ord=randperm(66); arp=a(ord); bar=arp(1:x); result=var(bar); end Second, I have what I am positive is a horrible set up: for k=1:50 for h=1:50 counting=0; for j=1:76 if R(j,3)== k y(j,h,k) = x(j); counting=counting+1; elseif R(j,3) == h && h~=k Y(j,h,k) = x(j); counting=counting+1; end end end Sorry if I have offended some keen MATLAB'ers eyes! Many thanks, Craig.
|
Pages: 1 Prev: FOR loop optimisation Next: FOR loop optimisation |