MATLAB: How to save a certain excel file to a specific folder

dropboxfolderinputsavinguigetdirxlswrite

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

Best Answer

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