1. 程式人生 > >matlab中fprintf寫入txt檔案\n無法換行

matlab中fprintf寫入txt檔案\n無法換行

  解決方法,將‘\n’換成’\r\n’,實現如下:

fp = fopen(save_train_txt,'w+');  %open the txt

fprintf(fp,'hello world!\r\nhello china!');

fclose(fp);