MATLAB: How to merge text files

columnsmergetextfile

for k = 1:100
fname = ['Image' num2str(k) '.txt'];
fid = fopen(fname,'wt');
for j=1:length(R)
fprintf(fid,'%f %f %f\n',R(j),C(j) ,Z(j));
end
fclose(fid);
end
I got 100 text files from this code, In it R,C,Z will be saved as columns.. Now, i want to merge all this text files in single text file as R,C,Z columns.. so, how to do..?

Best Answer

OS-X and Linux version:
!cat Image???.txt > all_Image.txt
No point in writing code when the operating system already has the facilities.