MATLAB: Fprintf multiple column string

fprintfstrings

I have imported a large file of numbers and letters into Matlab as a string. In short, after some number edits (which I know how to do), I am attempting to then use fprintf to save this to a new file. However, only the first column of the string is being saved. How do I save all the columns?
The input file and output file are shown in images.
Here is the code (the imported file is saved as variable S):
fileID = fopen('newfile.in','w');
fprintf(fileID, '%s\n', S);
fclose(fileID);

Best Answer

I figured out how to do it...
for i=1:length(S(:,1))
fprintf(fileID, '%s ',S(i,:)');
fprintf(fileID,'\n');
end
Cheers!