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: deleting elements from vector
Replies: 3   Last Post: Dec 25, 2012 11:42 PM

Advanced Search

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

Posts: 13
Registered: 12/20/12
deleting elements from vector
Posted: Dec 25, 2012 2:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hai friends...
I need to delete some values in the vector based on the values in the another vector
for example:
e = [1 1 0 0 2 3 , . . . . n]
a = [1 2 3 4 5 6 ...........n]
the result should be like this b = [1 2 5 6.....n] the value of 'a' corresponding to the place where e = = 0 should be removed.I tried like this
for j =1:length(e)
if(e == 0)
data[j] = [];

but it gives wrong answer like [1 2 4 6..n] .here the length of 'a' and 'e' are same.please reply me as soon as possible

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.