How do I save a cell array as txt file?
Show older comments
I have a 1x34 cell array containing 34 file names and paths e.g., "C:\Users\Jack\Documents\MATLAB\Sample_Data\Raw\NSX100.NC5". I simply want a txt file containing this info, one path per line, in order to process them in batches at a later date.
Answers (1)
Star Strider
on 25 Mar 2018
One approach is just to use fprintf:
AC = {'abd', 'defg', 'hijklm', 'nop'};
fid = 1;
fprintf(fid, '%s\n', AC{:})
producing:
abd
defg
hijklm
nop
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!