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.
Change variable name in mat.
Is there any other better way to do this than.
There may be variables in the program that have the same name as the strings in the 55 cells but what you have in the cells are simply strings so you can just reassign them to whatever you want.
Learn more about change variable names variable change matlab.
Change variable names in a table.
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.
Ok i opened your mat file and it s simply a 1 row by 55 column cell array a row vector of cells.
T load.
This saves my data in data mat file but with variable name mydata.
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.
This method follows the general rule of thumb to avoid poofing variables into the workspace.
In each cell is simply a string.
You could then use struct2cell to trivially access the field contents and place these into one array numeric cell etc using basic matlab indexing.
For mat files append adds new variables to the file or replaces the saved values of existing variables with values in the workspace.
Defines a variable named array or assigns a new value to an existing variable with the name array which is an array consisting of the values 1 3 5 7 and 9 that is the array starts at 1 the initial value increments with each step from the previous value by 2 the increment value and stops once it reaches or to avoid exceeding 9 the terminator value.
A similar problem occurs if i load a file but for any reason have no possibility to read out the name of the variable stored in it.
Thanks for your answer but that is not what i was looking for.
Share improve this answer follow answered nov 8 11 at 1 05.
Note that it is actually much easier to process a sequence of mat files if they contain exactly the same variable names because then these can be trivially imported into one non scalar structure and accessing using simple efficient indexing.
Say that i have a mat file that contains a variable and i need to load this variable and give it a different name.
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.