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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by