Save selected variables into a file

4 ビュー (過去 30 日間)
Thang  Le
Thang Le 2014 年 4 月 5 日
コメント済み: Image Analyst 2014 年 4 月 5 日
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')
  1 件のコメント
Thang  Le
Thang Le 2014 年 4 月 5 日
Thank you, Walter!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by