How to merge two files into one text file?
问题 I am trying to merge two text output file into one text file . file 1: fin=fopen('d://box1.txt','wt'); fprintf(fin,' Hello \n'); file 2: fin=fopen('d://box2.txt','wt'); fprintf(fin,'welcome \n'); Any thoughts? 回答1: I don't think there is a matlab way of doing it easily. But you can use system commands: Windows: system(type a.txt b.txt >ab.txt) Linux: system(cat a.txt b.txt >ab.txt) Dont forget to put the path in the files if they are not in your current directory! This works: fin=fopen('D: