Code
strings={'s1' 's2' 's3'};
a=[1 2 3];
outputfile = 'output.txt';
%%// Code to horziontally concatenate to result in a Nx2 cell array
out = [num2cell(num2str(a,'%d')') strings']
%%// Write to outputfile - Method 1
out = out';
fid = fopen(outputfile,'w');
fprintf(fid, '%s\t%s\n', out{:});
fclose(fid);
%%// Write to outputfile - Method 2
%%// Create a text file and clear it out of any content. This is needed, as otherwise
%%// XLSREAD was initializing CSV files with weird characters
%% dlmwrite(outputfile,'');
%%// Write to CSV file using XLSREAD
%xlswrite(outputfile,out)
%%// Verify
type(outputfile)
Output
out =
'1' 's1'
'2' 's2'
'3' 's3'
1 s1
2 s2
3 s3