for j=1:1:8x=[1 2 3 4 5 6 7 8];if x(j)>5x(j)=subs(x(j),x(j),6);elsex(j)=subs(x(j),x(j),0);endend
MATLAB: I will appreciate any suggestion on this simple code. I want to substitute the elements of x >5 with 6 and x<5 with zero.
if statement
if statement
for j=1:1:8x=[1 2 3 4 5 6 7 8];if x(j)>5x(j)=subs(x(j),x(j),6);elsex(j)=subs(x(j),x(j),0);endend
Best Answer