I have the following code, it is part of a much larger one. The total execution time for the whole code is around 50 sec. I am trying to reduce this figure to few secs. So the first thing is I started to look for for loops to reduce.
The following part of the code is taking 33 sec. (more than half the total time) and I am only creating strucs. arrays
NOC=100; NOBS=2; NORB_PER_BS=5; NOU=200 ; for k=1:NOU U1(k).SINR_MAX=0; U1(k).SINR_F_AVG=0; U1(k).v=[]; U1(k).w=[]; U1(k).SINR_IND={}; U1(k).ASSIGNED=0; U1(k).SINR_MAX_CANDIDATES=[]; for n=1:NORB_PER_BS for b=1:NOBS for v=1:NOU U(k,n,b).Q_LIST=[]; U(k,n,b).Q_LIST1=[]; U(k,n,b).Q_LIST_MEMBERS=[]; U(k,n,b).Q_MIN_MEMBERS=[]; U(k,n,b).Q_MIN=[]; SINR(k,n,b)=0; end end end end
Best Answer