Borrar filtros
Borrar filtros

changing a .mat file for SPM batch process

8 visualizaciones (últimos 30 días)
Victoria Klimaj
Victoria Klimaj el 19 de Sept. de 2013
I am trying to change SPM preprocessing parameters stored in a .mat file. I've figured out MATLAB doesn't seem to allow changing the values within the cell (it gave me strange errors indicating that the entire file no longer existed when I tried to change them). What would be the easiest way to edit these variables?

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Sept. de 2013
If you are trying to change just one variable within a .mat that contains many variables, then one route is to use the -append flag at the time you save the revised variable: http://www.mathworks.com/help/matlab/ref/save.html
Note that this will cause the .mat file to get longer; the old variables will not get deleted when you use -append, they will just not be used.
Another approach is to use the matfile class, which will probably need you to use -v7.3 files.
  2 comentarios
Victoria Klimaj
Victoria Klimaj el 20 de Sept. de 2013
I'm new to Matlab, so I have a few questions about how that would work-- I have a script that uses the variables in the .mat file that I was hoping to change. By appending variables to the .mat file, these references will have to change, correct? Is this just functioning the same way as adding information in a new row or column would? Will this also be the case if I'm using the matfile class?
Or does the appending happen within a cell, functioning to essentially replace the old variable while still keeping the old information?
Thanks for your help!
Walter Roberson
Walter Roberson el 20 de Sept. de 2013
If you use save -append, then the entire variable is replaced; it does not append on to the end of a variable, and you cannot just replace one cell in the variable.
If you use matfile then what you can change is more flexible.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by