saving files in a folder

조회 수: 5 (최근 30일)
Kofi Agyemang Amankwah
Kofi Agyemang Amankwah 2023년 6월 11일
댓글: Kofi Agyemang Amankwah 2023년 6월 11일
I am trying to save some data named (cn,y,z) into the directory with folder, vfolder. I expect the file (cn,y,z) to be contained in Pzz5X10. I keep getting errors anytime I run the code below. Any help will be appreciated.
Thanks.
zz = '10';
f = '5';
vfolder = pwd;
save([vFolder,'\' 'Pzz'+f+'X'+zz.mat'],'cn','y','z');

채택된 답변

Stephen23
Stephen23 2023년 6월 11일
save([vFolder,'\' 'Pzz'+f+'X'+zz.mat'],'cn','y','z');
% ^^^^^^^ invalid syntax
Better:
fnm = sprintf('Pzz%dX%d.mat',5,10);
save(fullfile(vFolder,fnm),'cn','y','z')
  댓글 수: 1
Kofi Agyemang Amankwah
Kofi Agyemang Amankwah 2023년 6월 11일
thanks. please, can you resolve the issue by retaining the format i used?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by