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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:15:40+00:00 2026-06-04T12:15:40+00:00

I am trying to reference an element buried within a structure that I did

  • 0

I am trying to reference an element buried within a structure that I did not create (hence I don’t know the exact way in which it was built).

Having loaded the structure, if I type:

dataFile.RECORDINGS.eye

I receive the following output:

ans =

    2


ans =

    2

Both of those variables will always be the same, but they could be at any time 1, 2 or 3. What I’d like to do is check with a switch statement which looks like this:

switch dataFile.RECORDINGS.eye
    case {1, 2}
        % action A
    case 3
        % action B
end

Of course, the above throws up an error because ‘case’ cannot check whether dataFile.RECORDINGS.eye contains a given value since there are two elements stored under that address. So, my question is: how do I reference just one of the elements? I thought it would be as simple as replacing the first line with:

switch dataFile.RECORDINGS.eye(1)

…But, this gives the error:

??? Field reference for multiple structure elements that is followed by more reference blocks is an error.

Similarly, I can’t access the element like this:

switch dataFile.RECORDINGS.eye.1

…As I get the following error:

??? Dot name reference on non-scalar structure.
  • 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-04T12:15:41+00:00Added an answer on June 4, 2026 at 12:15 pm

    If the values are really always the same, you can try the following to get a scalar that can be used in the switch command:

    unique([dataFile.RECORDINGS.eye])
    

    By the way, did you try to index RECORDINGS, i.e.,

    dataFile.RECORDINGS(1).eye   
    dataFile.RECORDINGS(2).eye
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how do i get a reference to the element that matched? 'this' is not
This is the code from the class within which I am trying to reference
I'm trying to return a reference to an object, not pass it by value.
I'm trying to find the element that triggered a page exit. Say they click
I'm just trying to shorten a line of code that assigns HTML::Element->as_trimmed_text from an
I'm trying to create a custom function that unbinds and then binds an event.
I am trying to create a Hash that has as its value an array.
Please reference the this example : I'm trying to create vertical dividers between my
I can't seem to create a reference to my scrollView. I'm trying to test
I am trying to create multiple shortcuts to my application that pass different arguments

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.