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

3 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by