Save selected variables into a file

5 次查看(过去 30 天)
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 个评论
Image Analyst
Image Analyst 2014-4-5
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2014-4-5
save(fname, 'names', 'onsets', 'durations')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by