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

  • Home
  • SEARCH
  • 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 7838087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:58:28+00:00 2026-06-02T14:58:28+00:00

As input to a function, I am getting an array of target elements, T

  • 0

As input to a function, I am getting an array of target elements, T, and an array of structs S where each one has a .elems field, which is a list of integers (elements).

I’m sure there’s a simple way to do this in Matlab. How do I get the indices i of all structs where a specific element t of T is in S(i).elems contains t?

  • 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-06-02T14:58:29+00:00Added an answer on June 2, 2026 at 2:58 pm

    So I think you’ll need to do this with an arrayfun. I did:

    S = ... (1-by-N array of structs);
    T = ... (1-by-K array of numbers);
    indices = find(arrayfun(@(i)any(ismember(T, S(i).elems)), 1:numel(S)));
    

    any(ismember(T, S(i)elems)) tests is any of the things in T are in S(i).elems. The arrayfun repeats this for each struct in S. find extracts indices from the logical array that is returned by the arrayfun.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a add input field function which is working fine. I would
Input rz value In the head I have: Event.observe(window, 'load', function() { $$(input).each(function(field){ Event.observe(field,
I have such code: function allValid() { $('input').each(function(index) { if(something) { return false; }
So the have seem something like this today: $$('input').each(function() { // do something });
I have progress.js file which has the following code $('#text_area_input').keyup(function() { var text_area_box =$(this).val();//Get
I created a ViewModel which has an observable property. I bind this array to
I wish to receive one array as input, filter values from it, and output
I am getting Error java.lang.NumberFormatException: For input string: passing JSON array to Spring-MVC.. Here
If papply returns a function of less arity than an input function, is there
$('input').change(function(){ alert($(this).val()); }); $('input').val(1); This dont work. I need capture the change input with

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.