Save selected variables into a file

4 visualizaciones (últimos 30 días)
Thang  Le
Thang Le el 5 de Abr. de 2014
Comentada: Image Analyst el 5 de Abr. de 2014
Hi,
I have what seems to be a very simple problem but I just can't figure it out. I have a number of variables including 3 specific variables: names, onsets, and durations. All three of these variables are 1x12 cell. I want to save these three variables into a .mat file. Since this is a loop, previously I have specified the file name (fname=[Q{i} '_' 'WM' '_' Block{m} '.mat'];). I tried save fname names onsets durations but this incorrectly gives me fname.mat.
Could anyone help?
  1 comentario
Image Analyst
Image Analyst el 5 de Abr. de 2014
If you don't use parentheses to use the "function" form of save, then it thinks fname is the actual filename itself rather than the name of a variable containing the filename. Confusing, I know - that's way I nearly always use the function form of functions except for really simple ones like axis, cla, etc.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Abr. de 2014
save(fname, 'names', 'onsets', 'durations')

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by