The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Save FOR loop data into a vector
Replies: 1   Last Post: Feb 13, 2014 10:31 AM

Advanced Search

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

Posts: 1
Registered: 2/13/14
Save FOR loop data into a vector
Posted: Feb 13, 2014 4:13 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello everybody,

I have a problem when I try to place the data that I get from a FOR loop into a vector.
Here is my example:

X = [ -5 1 -2 9 100 -3 ]

for i = X(1:1:end)
if find(0<i & i<10) == 1
Y = i
else Y = NaN

I get the results generated after every iteration. I would like them placed into a vector.
Could anyone give me a hint?

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.