How to use writetable to write a file and save this file in the specific location

9 vues (au cours des 30 derniers jours)
Chao Zhang
Chao Zhang le 23 Nov 2021
Commenté : Chao Zhang le 23 Nov 2021
Hi all,
I have a structure and use struct2table to convert it as table, then use writetable function to generate a xlsx file, but my question is how to use writetable function to generate the file in the specific folder location, because my code (in the following) is always generate the file in the default location.
% Output the file
for i = 1 : size(M,2)
temp1 = M(i); %The number of columns of M
TYPE = temp1.type;
temp1 = rmfield(temp1,'type');
writetable(struct2table(temp1), 'New_file.xlsx', 'sheet', TYPE)
clearvars temp1
end
disp('Done!')
Could you please show me how to generate the file in an specific location, many thanks in advance for help!
  2 commentaires
dpb
dpb le 23 Nov 2021
See the documentation/examples at
doc fullfile
Chao Zhang
Chao Zhang le 23 Nov 2021
Thank you! I can accept your answer if you put your comments in answer, cheers!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by