Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1494
Number of posts: 2174

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Indexing Posted by atins on 25 Mar 2010 at 4:37 PM
I need to make a function that will have an input vector of 0s and 1s and it needs to return a vector of the indices for all the values of one from that input vector. For example, if the input vector is x = [ 1 0 1 0 1 1], the vector that is being returned should be ans = [1 3 5 6].

I am having a hard time because you are not supposed to use the find function. We are supposed to use forloops and if end statements.
Thread Tree
atins Indexing on 25 Mar 2010 at 4:37 PM
jjasso5 Re: Indexing on 26 Mar 2010 at 2:34 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.