fprintf






% write/print formatted strings from cell array (to stdout fid=1)

C={'A1','A2','A3'}

C
  {'A1'}    {'A2'}    {'A3'}

fprintf(1,'%s\n',C{:})
  A1
  A2
  A3


% print to text file "sampleIDs.txt" (fid - file identifier)

fid = fopen('sampleIDs.txt','w');
  fprintf(fid,'%s\n',C{:})
fclose(fid);