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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:06:38+00:00 2026-06-03T04:06:38+00:00

I came across some matlab code that did the following: thing.x=linspace(… I know that

  • 0

I came across some matlab code that did the following:

thing.x=linspace(...

I know that usually the . operator makes the next operation elementwise, but what does it do by itself? Is this just a sub-object operator, like in C++?

  • 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-03T04:06:40+00:00Added an answer on June 3, 2026 at 4:06 am

    Yes its subobject.

    You can have things like
    Roger.lastname = “Poodle”;
    Roger.SSID = 111234997;
    Roger.children.boys = {“Jim”, “John”};
    Roger.children.girls = {“Lucy”};

    And the things to the right of the dots are called fields.

    You can also define classes in Matlab, instatiate objects of those classes, and then if thing was one of those objects, thing.x would be an instance variable in that object.

    The matlab documentation is excellent, look up “fields” and “classes” in it.

    There are other uses for ., M*N means multiploy two things, if M, N are both matrices, this implements the rules for matrix multiplication to get a new matrix as its result. But M.*N means, if M, N are same shape, multiply each element. And so no like that with more subtleties, but out of scope of what you asked here.

    As @marc points out, dot is also used to reference fields and subfields of something matlab calls a struct or structure. These are a lot like classes, subclasses and enums, seems to me. The idea is you can have a struct data say, and store all the info that goes with data like this:

    olddata = data; % we assume we have an old struct like the one we are creating, we keep a reference to it
    
    data.date_created=date();
    data.x_axis = [1 5 2 9];
    data.notes = "This is just a trivial example for stackoverflow.  I didn't check to see if it runs in matlab or not, my bad."
    data.versions.current = "this one";
    data.versions.previous = olddata;
    

    The point is ANY matlab object/datatype/whatever you want to call it, can be referenced by a field in the struct. The last entry shows that we can even reference another struct in the field of a struct. The implication of this last bit is we could look at the date of creation of the previous verions:

    data.versions.previous.date_created
    

    To me this looks just like objects in java EXCEPT I haven’t put any methods in there. Matlab does support java objects which to me look a lot like these structs, except some of the fields can reference functions.

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

Sidebar

Related Questions

I came across some Java code that has a method containing the following: static
I came across some Java code that had the following structure: public MyParameterizedFunction(String param1,
I came across some code that boils down to the following: enum BAR {
I came across some legacy code that contains a function like this: LPCTSTR returnString()
I came across some code today that surprised me. A variable was defined (outside
I came across some tests that included code like this: if (this != null)
I came across some code recently that used a custom error handler to turn
I recently came across some Java code that simply put some strings into a
Came across some code today that had a javascript array, made in php, using
I came across some code today that looks like this: subroutine sub(hello,world,this,routine,takes,a, & &

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.