Save a Table as a .csv in a Specified Folder

66 次查看(过去 30 天)
Hello,
I followed this post about saving a table to a specific folder, but am not having any luck.
Here is the code I have:
save_table ='C:\Users\Folder Path\Data';
table_path_format = [save_table 'Name_of_File.csv'];
writetable(T,table_path_format);
where T is a 90 x 8 table.
Am I skipping a step?
I as also looing at this post about the writetable command.
Thanks.

采纳的回答

Adam Danz
Adam Danz 2022-11-8
编辑:Adam Danz 2022-11-8
The accepted answer in the question you followed uses fullfile to construct the file path. That's much safer than constructing the file path by concatenating char vectors (like you're doing). Your table_path_format is missing a file separator character. fullfile adds that for you.
  1 个评论
Jon
Jon 2022-11-8
Yes, thank you that worked.
I originally did try that, but must've mis-typed something along the way when it didn't work.
Chekcing through it again with your advice saved the file to the correct folder.

请先登录,再进行评论。

更多回答(0 个)

类别

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

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by