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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:26:53+00:00 2026-06-07T07:26:53+00:00

I declare a class in matlab and here is the constructor and a function.

  • 0

I declare a class in matlab and here is the constructor and a function.

function Ri = RGBimages(datadir)
    if(isempty(dir(datadir)))
        warning([datadir, ' is empty']);
        return;
    end
    Ri.dataSrc=datadir;
    Ri.twoEnds = load([datadir,'\seIndex.txt']);
    Ri.startFrame = Ri.twoEnds(1);
    Ri.endFrame = Ri.twoEnds(2);
    Ri.numberOfFrames=Ri.twoEnds(2)-Ri.twoEnds(1)+1;
    Ri.faceLmks = zeros(68,2,Ri.numberOfFrames);
end

function obtainFaceLmks(Ri)
    indx=1;
    for i = Ri.startFrame;%:Ri.endFrame
        imstr = [Ri.dataSrc,'\rgb_',num2str(i),'.png'];
        [status,result] = system(['fitD -m src\my.amf -h src\haarcascade_frontalface_alt2.xml -i ',imstr,' -n 30']);
        if(status==-1)
            warning(result);
        else
            temp=flHelper(result(1:size(result,2)-59));
            Ri.faceLmks(:,:,indx)=temp;
        end
        indx=indx+1;
    end
    return;
end

then I do this:

ims = RGBimages('data\a01_s01_e01');

ims.obtainFaceLmks();

and it seems ims’s attributes (ims.faceLmks) didn’t change, why?

Thanks for anyhelp

  • 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-07T07:26:55+00:00Added an answer on June 7, 2026 at 7:26 am

    Value classes are passed by value. Consequently, a method should return the (updated) class instance, and you need to capture that. In other words, the method definition should be

    function Ri = obtainFaceLmks(Ri)
    

    and you’d call the method

    ims = ims.obtainFaceLmks();
    

    Handle classes are passed by reference. Consequently, a method doesn’t need to return the updated class instance, and you don’t need to capture it. However, you need to inherit from handle, and you need to implement a copy method to make a copy of a class instance; assigning to another variable won’t work.

    See the documentation for further info.

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

Sidebar

Related Questions

I have a situaion in which I want to declare a class member function
// declare a class with private variable int * _a // declare a function
In Matlab class it seems to be syntactically correct to declare property that is
If I declare class as abstract with no abstract methods declared in it, will
I have two questions. I know it is possible to declare class objects in
How would I declare a class that has a method/message that takes a selector,
I want my PHP extension to declare a class equivalent to the following PHP:
I have built a class in PHP and I must declare a class variable
I am trying to forward declare a class that is derived from a template
I'm getting this error whenever I attempt to declare a class: Parse error: syntax

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.