In MATLAB, you can create a matfile within a matfile using the matfile
function.
Here's a sample code that will create a matfile parent.mat
with a nested matfile named child.mat
.
main.m272 chars9 lines
Now you can use the child object to add variables to the child.mat file, and they will be nested within the parent.mat file.
main.m69 chars4 lines
Note that when you access the child variables through the parent, MATLAB will automatically load the child.mat file into memory. So, be aware of the size of the variables you store in the matfile, as they may cause memory issues.
gistlibby LogSnag