How do I save a cell array as txt file?

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)

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

Asked:

on 25 Mar 2018

Answered:

on 25 Mar 2018

Community Treasure Hunt

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

Start Hunting!