save variables in a file
조회 수: 1 (최근 30일)
이전 댓글 표시
I need to save in a .txt file some of the variables calculated. Each variables should occupy one column separated by tab. What is the most appropriate way of doing it?
with the line:
save('q20.txt','p','D','de','A','L','W','Per','RFF','En','D','Lm','Wm','Aratio','N2D','N3D','a','Df2D','Df3D','-ascii', '-tabs')
I save the variables in one file. But the variables are listed one below the other .
Thanks
댓글 수: 0
채택된 답변
Walter Roberson
2011년 5월 9일
fid = fopen('q20.txt','wt');
fprintf(fid, [repmat('%g\t',1,17),'%g\n'], [p(:), D(:), de(:), A(:), L(:), W(:), Per(:), RFF(:), En(:), D(:), Lm(:), Wm(:), Aratio(:), N2D(:), N3D(:), a(:), Df2D(:), Df3D(:)].' );
fclose(fid);
Note: the dot-apostrophe after the close-square-bracket is required for proper output
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!