Save selected variables into a file

4 vues (au cours des 30 derniers jours)
Thang  Le
Thang Le le 5 Avr 2014
Commenté : Image Analyst le 5 Avr 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 commentaire
Image Analyst
Image Analyst le 5 Avr 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.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 5 Avr 2014
save(fname, 'names', 'onsets', 'durations')
  1 commentaire
Thang  Le
Thang Le le 5 Avr 2014
Thank you, Walter!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by