Hello, I'm having some problems with an if statement. This is what I want to do: If x>1 A=B elseif x<1 and x>0.1 A=C elseif x<0.1 and x>0.01 A=D elseif x<0.001 A=F
I don,t seam to be able to get this working. Any help is welcome
Here is the code:
Y=random('unif',0.01,2,100,1);
for i=1:100
if Y(1:i,1)>=1 c(i,1)=1; c(i,2)=0; c(i,3)=0; elseif (Y(1:i,1) < 1) && (Y(1:i,1) >= 0.1) c(i,1)=1; c(i,2)=0.5; c(i,3)=0; elseif (Y(1:i,1)<0.1) && (Y(1:i,1)>=0.01) c(i,1)=1; c(i,2)=1; c(i,3)=0; elseif Y(1:i,1)<0.01 c(i,1)=0; c(i,2)=1; c(i,3)=0; endend
Best Answer