You can then save the struct back out to the mat file with the struct flag.
Change variable name in mat file.
T load.
If you load the mat file into a struct i e.
Now you want to load that variable but with the name t.
Matlab 8 r2012b 28 1 6 0 17 september 11 2012.
What i am asking is how can i use the name of the mat file here lrww in the rest of the commands without having to write it manually.
I want to create a for loop that loads all the mat files and assigns the matrixes to a new name so i can access the different matrices specifically.
The mat file object allows you to access and change variables directly in a mat file without having to load the variables into memory.
Now i want to save values of mydata in mat file but i want to save the value under a variable name given via input function.
Access change parts of variables directly in mat files without loading into memory.
I have several matlab files 1 mat 2 mat 3 mat 25 mat and each file contains a 24x4 matrix named a.
Name of file specified as a character vector or string scalar.
If you do not specify filename the save function saves to a file named matlab mat.
This saves my data in data mat file but with variable name mydata.
Now whenever i am loading a new mat file i am changing the name of the variable 6 times in the program.
It would be cool to have a possibility to automatically determin the variable name or just to asign it to another given variable.
Is there any other better way to do this than.
Example matobj matfile filename writable iswritable enables or disables write access to the file.
If filename has no extension that is no period followed by text and the value of format is not specified then matlab appends mat if filename does not include a full path matlab saves to the current folder.
This method follows the general rule of thumb to avoid poofing variables into the workspace.
The load option with output argument then your variables become fields of that struct which allows you to rename them renaming variables themselves is not a fun task.
Matlab 7 14 r2012a 27 1 6 0 17 2012 march 1 2012 last version with 32 bit linux support.
Thanks for your answer but that is not what i was looking for.