Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by