I have a vector filter and I need to use the vector element index-number within the filter.
What would the syntax be for the INDEXNUMBER in the below example?
myVector(myVector < 0.05*(INDEXNUMBER/(120-INDEXNUMBER)));
Thanks,
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming I understand what you’re trying to do, you would just substitute
myVectorforINDEXNUMBER:The logical indexing (the part inside the outermost parenthesis, second line) is simply doing a logical comparison on all elements of myVector, returning an equal length vector of
0‘s and1‘s, and the selecting the elements ofmyVectorwhich correspond to the1‘s. If this isn’t what you’re doing, just make sure that your dimensions work out correctly (size of left hand inequality == size of right hand inequality == size of variable being selected) and all should be well.To use the position of each number, you could use the following: