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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:10:19+00:00 2026-05-29T06:10:19+00:00

I just started using Matlab, and I absolutely despise (or not properly understand), the

  • 0

I just started using Matlab, and I absolutely despise (or not properly understand), the typesystem (or lack thereof).

Why does this not work ? I just want structs within structs (in a recursive function)

    K>> d = struct('op',1,'kids',[])

    d = 

          op: 1
        kids: []

    K>> d.kids(1) = struct('op',2)
    Conversion to double from struct is not possible.

I tried other things, like making d=struct('op',1,'kids', struct([])), but nothing seems to work….

  • 1 1 Answer
  • 1 View
  • 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-29T06:10:20+00:00Added an answer on May 29, 2026 at 6:10 am

    When you index into it with (1), you’re trying to assign the struct in to the first element of d.kids, which is already a double array and thus a type mismatch. Just assign over the entire field.

    d.kids = struct('op', 2);
    

    To initialize it with a struct to start out with, do this, calling struct with no arguments instead of passing [] to it.

    d = struct('op',1, 'kids',struct());
    

    Don’t give in to despair and hatred yet. The type system can handle what you want here; you’re just making basic syntax mistakes. Have a read through the MATLAB Getting Started guide, especially the “Matrices and Arrays” and “Programming” sections, found in the online help (call doc() from within Matlab) or the MathWorks website.

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

Sidebar

Related Questions

I just started using Selenium 2 tonight so this will be very basic (I
I just started using Rails and am not sure what I'm not doing correctly.
Just started using this technique and am having strange results on the PC side.
I just started using events and delegates in C# and I'm not sure if
I just started using git with github. I followed their instructions and ran into
I just started using the MVCContrib grid in a test project. I'm having a
I just started using django for development. At the moment, I have the following
I just started using ELMAH and am a fan. My team supports a large
I just started using Qt and noticed that in each example code folder there
I just started using Qt and noticed that it uses its own make tool,

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.