How to save a certain excel file to a specific folder?
조회 수: 6 (최근 30일)
이전 댓글 표시
Does anyone know how to save an excel file that was already written to a certain folder? I want the excel file I save using xlswrite to save in my Dropbox folder for reference.
name_xls = input('What do you want to name the Excel file as?' , 's');
xlswrite(name_xls, exceloutput, '90CtT 45W','A1');
댓글 수: 0
채택된 답변
Uladzimir
2014년 7월 2일
편집: Uladzimir
2014년 7월 2일
you can do it with the standard uiputfile dialog, for example
[FileNameBodeWrite, PathNameBodeWrite] = uiputfile({'*.xls';'*.csv'},'Save As...',['defname' '.xls']);
if FileNameBodeWrite ~=0
if exist([PathNameBodeWrite FileNameBodeWrite],'file')
delete([PathNameLachWrite FileNameBodeWrite ]);
end
xlswrite([PathNameBodeWrite FileNameBodeWrite ],{'W,rad/s','K,dB','Phase,grad'}) %header
xlswrite([PathNameBodeWrite FileNameBodeWrite ],[w adb p],1,'A2') %data
end
Or point the path manually like this
xlswrite(['D:\DropBox\' name_xls '.xls'], exceloutput, '90CtT 45W','A1');
추가 답변 (2개)
Image Analyst
2014년 7월 2일
Try this more robust code:
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath % Or whatever folder you want.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!