Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: problem finding a value
Replies: 3   Last Post: Jan 21, 2013 2:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,231
Registered: 6/7/07
Re: problem finding a value
Posted: Jan 21, 2013 2:26 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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...

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.