Reputation: 496
I have a class like this:
classdef my_class
properties
prop_a
prop_b
end
methods(Static)
...
function o = load()
???
end
end
methods
function save(o)
???
end
...
end end
Please help me to write save and load methods. name of methods is clear and they should save and restore an object from a text file...
the properties are quite dynamic and have different row/col number.
Upvotes: 0
Views: 55
Reputation: 1960
As documented in the save function, you can save variables to file. As documented in the load function, you can load variables from file.
methods(Static)
function obj = loadFromFile( filename )
obj = load( filename );
end
end
methods
function saveToFile( obj, filename )
save( 'test', 'obj' );
end
end
Caveat
Upvotes: 1