w_mean = -1.961685443326542e+03;
fid=fopen('b.txt','wt'),
fprintf(fid,'%6.4f\n',w_mean), %顯示小數後4位
% fprintf(fid,'%s\n',w_mean), 完整顯示
% fprintf(fid,'%s\n',num2str(w_mean)),
fclose(fid) ;
輸出的txt檔中的內容結果
-1961.6854
參考了這些網站:
http://bime-matlab.blogspot.tw/2006/10/76-fprintf.html
http://blog.xuite.net/jesonchung/scienceview/93550967-MATLAB%E7%AC%A6%E8%99%9F%E7%94%A8%E6%B3%95%EF%BC%882%EF%BC%89
沒有留言:
張貼留言