Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
dpb
Posts:
6,852
Registered:
6/7/07
|
|
Re: problem finding a value
Posted:
Jan 21, 2013 2:26 PM
|
|
On 1/21/2013 10:06 AM, Iris wrote: > Hello Josh, thank you for your answer! > The problem stands... > imagine that: > x_x = > ...
> 100.000 -95.340657 -154.28396 2.14672 -326.82169
Fixing format to be legible...
> the 4th (for i = 4) value is inside the range that i want, but then it > continues for i=5 which is not inside the range... so it will do B... > how can i do this?
Well, what would be the problem as written (altho I'd likely use CASE instead of IF here...)
>> for i=1:length(x_x) if (x_x(i)>-5) & (x_x(i)<2.5) disp('A') else disp('B') end,end B B B A B >>
Looks like exactly what you asked for to me...
--
|
|
|
Date
|
Subject
|
Author
|
|
1/21/13
|
|
Iris
|
|
1/21/13
|
|
Iris
|
|
1/21/13
|
|
dpb
|
|
|