How to export Excel files to the specific folder?
Show older comments
I have the below code:
for p = 1:numel(C)
filename = C{p}{1,2};
if ~isempty(filename{:})
sprintf('%s.xlsx',filename{:})
writetable(C{p},sprintf('%s.xlsx',filename{:}))
end
end
I want to save all excel files generated in this code to "E:\AZAR\xlsx files 1989-2018" instead of the current folder. does anyone have an idea for how to do it?
Thank you all.
1 Comment
Star Strider
on 15 Jan 2020
Accepted Answer
More Answers (1)
Jakob B. Nielsen
on 15 Jan 2020
You can find the answer in the documentation for the writetable function. You must simply format your filename to be E:\AZAR\xlsx files 1989-2018\yourname.xlsx, for example using the strcat function, like;
strcat('E:\AZAR\xlsx files 1989-2018',sprintf('%s.xlsx',filename{:})));
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!