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 9098127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:17:13+00:00 2026-06-17T00:17:13+00:00

I have a struct array named Lst . Every struct has the following form:

  • 0

I have a struct array named Lst. Every struct has the following form:

Point (x,y)
Type (1-6)

I want get the separate array of points for each type. How can I get it?

Lst(Lst.Type==1);

won’t work since Type is not a field of Lst but of Lst(i).

In addition, is there a way to save the indexes of each item or an alternative way to then combine them again to the original order?

  • 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-17T00:17:14+00:00Added an answer on June 17, 2026 at 12:17 am

    L1 = Lst([Lst.Type]==1); will give you the subset L1 of Lst where Type == 1.

    Likewise, you can use idx1 = find([Lst.Type]==1) to memorize your indexes.

    EDIT: the above uses the [] operator to aggregate the field elements Type of Lst into an array. To your comment/question, you could use the exact same operator also to obtain an array of specific field elements X of a subset of the structured array, as in

    X1 = [Lst([Lst.Type]==1).X];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a byte array which needs to be marshalled into the following struct:
I have a struct which has several arrays within it. The arrays have type
I have a struct named Game with an array of levels, defined like this:
I have a struct array Imgs and it includes following properties of image files
I have the following structure: template <class T> struct Array{ int lenght; T *
I have got an array of the following structs: typedef struct _my_data_ { unsigned
I have a struct-array that contains details of different reports that can be run.
I have a struct array called AnalysisResults , that may contain any MATLAB datatypes,
I have a struct with a dynamic array inside of it: struct mystruct {
I have a Deque that contains this kind of stucts. struct New_Array { array<array<int,4>,4>

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.