Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4033936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:54:33+00:00 2026-05-20T11:54:33+00:00

I can look for the position of a value, i.e. 45, in a vector

  • 0

I can look for the position of a value, i.e. 45, in a vector ‘data’ using the ‘==’ operator and the ‘find()’ function:

data = [ 71 65 23 45 34 12 21 34 52 ];
value = 45;

find (data == value)
ans =  4

Is there a way to do the same for several values without using a loop, i.e. i would like to get [ 4 5 7 ] in a single call:

values = [ 45 34 21 ];
find (data == values)
error: mx_el_eq: nonconformant arguments (op1 is 1x9, op2 is 1x3)
error: evaluating argument list element number 1
error: evaluating argument list element number 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:54:34+00:00Added an answer on May 20, 2026 at 11:54 am

    Try the ismember function:

    data = [ 71 65 23 45 34 12 21 34 52 ];
    values = [ 45 34 21 ];
    
    find(ismember(data, values))
    

    Giving:

    ans =
    
     4     5     7     8
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can look at the row.count or tables.count, but are there other
Is there a command, or a set of tables I can look at to
I’ve had a good look and can’t seem to find out how to select
Is it a measure of anything that a developer or even manager can look
If I delete a file in Subversion, how can I look at it's history
How can I improve the look and feel of my Linux desktop to suit
It doesn't look like basic javascript but nor can I use JQuery commands like
Can anyone recommend a free grid/graphing component for C#/.NET? I'm having a look at
Let's look at an example - books. A book can have 1..n authors. An
When I look at a directory in Windows Explorer, I can see a ProductName

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.