How to use uigetdir to make a folder at certain directory and save some excel data inside the folder?
조회 수: 5 (최근 30일)
이전 댓글 표시
Kasih Ditaningtyas Sari Pratiwi
2017년 12월 3일
댓글: Kasih Ditaningtyas Sari Pratiwi
2017년 12월 4일
Hi! I have a question about how to use uigetdir to make a folder at certain directory. I managed to write a code below to make a folder and save some data inside the folder, but the folder is in the matlab directory. I want to use uigetdir to choose certain directory and make a folder there then to save some files in that folder. Is it possible to do that? Here is my matlab code:
%%Save output file to excel
prompt = {'Enter new folder name:'};
dlg_title = 'New Folder';
num_lines = 1;
def = {'New Folder'};
file_name = inputdlg(prompt,dlg_title,num_lines,def);
file_name=char(file_name);
mkdir(file_name);
output=fullfile(pwd, file_name);
file1=fullfile(output,'flowCSV.xls');
file2=fullfile(output,'peakflowanalysis.xls');
file3=fullfile(output,'drytable.xls');
writetable(flowCSV,file1);
writetable(peakflowanalysis,file2);
writetable(drytable,file3);
clearvars prompt dlg_title num_lines def file_name output file*
Thank you for your help.
댓글 수: 0
채택된 답변
Image Analyst
2017년 12월 3일
The dialog box itself has a "new folder" menu item so the user can do that. You don't need to do anything.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!