In my script I first defined a for loop:
for n = 1:inf a = 10^(n+1); b = 10*a;
so the for-loop assigns every iteration new values to my variables a and b.
Right after it I made an conditional statement:
if (a <= x)&&(x < b)
I want my value x (which I assign when activating the script) to lie between a and b. But matlab won't agree with me. It says:
Operands to the || and && operators must be convertible to logical scalarvalues.Error in palin (line 10)if (a <= x)&&(x < b)
Though I thought values to the variables a and b were assigned earlier in the script, matlab would recognize these values. I was wrong. Does anybody has a suggestion what I could do to fix this error? I hope it is very easy to solve, so that soon someone will help me out of this. Thanks in advance.
Best Answer