That should work. Another way is:
cols = size(A,2);
fmt = [repmat('%s,', 1, cols - 1), '%s\n'];
Atrans = A.'; %need to transpose it
fprintf(fileID, fmt, Atrans{:});
with no loop.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!