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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:48:24+00:00 2026-06-19T02:48:24+00:00

There is a handle class Foo : classdef Foo < handle properties (SetAccess =

  • 0

There is a handle class Foo:

classdef Foo < handle   
    properties (SetAccess = public, GetAccess = public)
        x
    end

    methods
        function obj = foo(x)
            % constructor
            obj.x = x;
        end 
    end       
end

I create an object of Foo:

data = [1 2];
foo = Foo(data);  % handle object

I would like to create a reference (handle) variable a that points to foo.x. Is this possible in Matlab? For example, the following does not work:

a = foo.x;       % here `a` equals [1 2], `a` is not a handle object  
foo.x = [3 4];   % set property `x` to [3 4];
disp(a);         % a still equals [1 2] 
                 % even though the property `foo.x` has changed
                 % I want `a` to change when `foo.x` is changed.
  • 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-19T02:48:26+00:00Added an answer on June 19, 2026 at 2:48 am

    No, unfortunately it is not possible in Matlab. References can be only to objects which are instances of some class inherited from handle (like your class Foo). I.e., this is possible:

    bar = foo
    foo.x = [3 4]
    disp(bar.x)      % would be [3 4]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php class a { public function foo() { echo __METHOD__ . PHP_EOL; } }
I want to use a custom class that could handle querying easily. Are there
Is there a better way to handle my FindAdjacent() function for my A Star
Is there a php function to handle the encodings below? .replaceAll(\u00c3\u0080, &Agrave;) .replaceAll(\u00c3\u0081, &Aacute;)
[InheritedExport(typeof(MyAbstractClass)) public abstract class MyAbstractClass { [Import] protected IFoo Foo { get; private set;
I have a handle-based class that I need to create a vector of. An
There is something that confuses me. Let there be a class member Foo::$bar ,
I have a custom class Foo with properties A and B. I want to
Consider the following class: class Foo { private: void bar(const size_t); public: void foo();
Actually I'm looking for a jQuery plug-in that can handle this: there is 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.