필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Tomaszzz
Tomaszzz 2022년 2월 23일
댓글: Tomaszzz 2022년 2월 23일
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