Associate
- Joined
- 6 Nov 2006
- Posts
- 722
- Location
- Devon
I'm trying to pick out elements of an array for plotting which fulfill a certain condition on another array to plot. I know that probably isn't too clear, so here's an example of how I'm doing it currently
Now I remember reading somewhere that this wasn't the best practice way of doing it but I'm not sure what the best way of doing it is. If anyone can help I'd appreciate it as I'm trying to improve my programming skills and to do things the right way rather just whatever works which is how I currently do it. I'm sorry if this is a stupid/easy question.
Code:
j=1;
for i=1:221184
if(lat(i)>0)
qplot(j)=q(i) ;
psiplot(j)=psi(i) ;
j=j+1 ;
end
end
scatter(psiplot,qplot)
Now I remember reading somewhere that this wasn't the best practice way of doing it but I'm not sure what the best way of doing it is. If anyone can help I'd appreciate it as I'm trying to improve my programming skills and to do things the right way rather just whatever works which is how I currently do it. I'm sorry if this is a stupid/easy question.