Managing custom classes, mat-files, and namespaces
Say I have a (simple) custom class, defined with a classdef. Let’s say it’s defined in my_class.m
I then generate a bunch of objects of the class, and save the results to a matfile: my_data.mat.
I then want to reorganize my code, either by:
renaming my class (but otherwise keeping the definition the same). Now I have my_class_ver1.m as the classdef.
introducing namespaces. Here, I’ve moved the file, my_class.m, into a namespace directory, i.e.,: +ver1/my_class.m
Is there any way to provide a class (re)mapping when loading the existing my_data.mat file? As it stands, Matlab just loads the file as an int a uint32 array. For #2, just importing the namespace (import ver1.* or import ver1.my_class) does not work.Say I have a (simple) custom class, defined with a classdef. Let’s say it’s defined in my_class.m
I then generate a bunch of objects of the class, and save the results to a matfile: my_data.mat.
I then want to reorganize my code, either by:
renaming my class (but otherwise keeping the definition the same). Now I have my_class_ver1.m as the classdef.
introducing namespaces. Here, I’ve moved the file, my_class.m, into a namespace directory, i.e.,: +ver1/my_class.m
Is there any way to provide a class (re)mapping when loading the existing my_data.mat file? As it stands, Matlab just loads the file as an int a uint32 array. For #2, just importing the namespace (import ver1.* or import ver1.my_class) does not work. Say I have a (simple) custom class, defined with a classdef. Let’s say it’s defined in my_class.m
I then generate a bunch of objects of the class, and save the results to a matfile: my_data.mat.
I then want to reorganize my code, either by:
renaming my class (but otherwise keeping the definition the same). Now I have my_class_ver1.m as the classdef.
introducing namespaces. Here, I’ve moved the file, my_class.m, into a namespace directory, i.e.,: +ver1/my_class.m
Is there any way to provide a class (re)mapping when loading the existing my_data.mat file? As it stands, Matlab just loads the file as an int a uint32 array. For #2, just importing the namespace (import ver1.* or import ver1.my_class) does not work. classdef, namespace, classes, import MATLAB Answers — New Questions