MATLAB: Writing a variable and reading it elsewhere, how to do that

data import

After running a programm I have a the end a set of coordinates like Z=[0.4, 0.9; 1.3, 1.4; 2.0, 2.2] I like to use Z in another programm but I do not understand the details of read and write functions. Never done that before…

Best Answer

To save it
save(fullFileName, 'Z');
Then, to load it in your other program
storedStructure = load(fullFileName);
Z = storedStructure.Z;
You can save multiple variables if you want, just list them
save(fullFileName, 'Z', 'myvar', 'someOtherVar');