2

I have class in matlab using classdef as,

classdef scores
    %   SCORES Summary of this class goes here
    %   Class for stroring the individual scores array of each of the
    %   comparison of the models and the test files including the number of
    %   coefficients used and number of gaussian 

    properties
        detailed_scores;
        no_of_gauss=0;
    end

    methods
    end
end

Created objects and saved into an array as;

for i=1:99
    score = scores;
    score.detailed_scores = somescore(:,9);
    score.no_of_gauss = i;
    array = [array score];
end

Now, I would want to save it into a matfile as;

save('somematfile.mat','array');

Is it possible to load this array later on to retrieve the data back ?

1 Answer 1

6

Yes, load somematfile would just do that.

load somemathfile
for k = 1:length(array)
  obj = array(k);
  obj.detailed_scores
end

However, you have to be careful if you change the class definition, especially if you remove/rename or add new properties to the class. In that case you may need to implement saveobj and loadobj methods.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.