Let's say I have a .mat file with several instances of the same structure, each of which has a different variable name.
I want to process every instance found in a file (which I find using whos('-file' ... ). I was hoping that load would allow me to specify the recipient name for the variable so that I would not have to worry about collisions (and therefore I did not have to write self-modifying code a la eval ).
Most likely, this method creates a helper function that, using variables with names, which I hope do not conflict with the contents of .mat, does something like:
- Are there
whos in the file to get the contained names. - Iteratively load each contained structure.
- Uses
eval to assign the loaded structure to, say, an array of cells (where one column of the array contains the structure names of the .mat file and the corresponding column with the actual contents of each structure from the .mat file).
Is there a more elegant way to accomplish the same thing?
jhfrontz
source share