How to convert table to a csv file and save it in a remote location?

3 次查看(过去 30 天)
Hi all,
I have a 1x72 table (attached) that I would like to convert to a csv file and save in a specific folder location.
I can save the table as a mat file to my desired location and with the desire name (loop over multiple files) in the following way but not sure how to apply it when saving the table to the csv file. Can you help please?
save(fullfile([DotFolder(1:end-31) '_Stats'],[all_files(k).name(1:end-8) '_Stats.mat']), 'Stats');
For example when I try this:
writematrix([DotFolder(1:end-31) '_Stats'],[all_files(k).name(1:end-8) '_.csv']), Stats;
results in saving the csv with the desired name but in the folder where the code is located and the content of the file is just the location of the folder, rather than the data from the table

采纳的回答

Jan
Jan 2022-2-23
Folder = 'D:\Your\Folder';
File = [all_files(k).name(1:end-8) '_.csv'];
writematrix(Stats, fullfile(Folder, File));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by