Table won't export as .csv into correct folder
이전 댓글 표시
I am trying to export a big table (62413451x16) as a .csv file into a specific folder. This seems like it should be simple but it's not showing up for some reason. I am trying to run this code below:
save_table = 'G:\My Drive\directory';
table_path = fullfile(save_table, 'file.csv');
writetable(data, table_path)
댓글 수: 5
Taylor Azizeh
2023년 10월 27일
Voss
2023년 10월 27일
What is the evidence that the file is not showing up? Does it not appear in the folder in Windows File Explorer? You may have to refresh the view (ctrl+r in File Explorer).
Can you read the file within MATLAB? E.g.:
writetable(data, table_path) % write the file
T = readtable(table_path) % check the result
Walter Roberson
2023년 10월 27일
try again with 'useexcel' false
Taylor Azizeh
2023년 10월 27일
Walter Roberson
2023년 10월 27일
writetable(data, table_path, 'UseExcel', false)
채택된 답변
추가 답변 (1개)
Pratyush
2023년 10월 27일
0 개 추천
Hi Taylor,
I understand that you are not able to export your CSV file to the desired folder.
The code you provided seems correct for exporting a table as a .csv file in MATLAB. However, there are a few things you can check to troubleshoot the issue:
- Make sure the "data" variable contains the table you want to export. You can verify this by displaying the table or checking its dimensions.
- Ensure that the directory "G:\My Drive\directory" exists and is accessible. Verify that you have write permissions for the specified directory.
- If there are no error messages try accessing the file from MATLAB or command prompt.
- If you have a numeric or cell array that you want to export as a CSV file, you can use the "writematrix" function. This function is generally faster than "writetable" for large arrays.
댓글 수: 2
Taylor Azizeh
2023년 10월 27일
Stephen23
2023년 10월 28일
"The file is exported now, but as a text file."
There is nothing stopping your from changing the file extension, if that is the problem.
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!