필터 지우기
필터 지우기

writing a matrix in a text file

조회 수: 4 (최근 30일)
fatima hd
fatima hd 2015년 6월 26일
답변: Star Strider 2015년 6월 26일
I have array a=[1 2 3 4 5 6], and also array b=[9 8 7 6 5 4]; there is 2*6 matrix p=[a; b], I mean p=[1 2 3 4 5 6; 9 8 7 6 5 4]; I want to write matrix p in a file but 6*2, I mean the outcome is [1 9; 2 8;3 7; 4 6;5 5; 3 4] is this a correct matlab code for this??
ff = fopen('final.txt','wt');
fprintf(final, '%f\n', p);
fclose(final);

답변 (1개)

Star Strider
Star Strider 2015년 6월 26일
This works:
fprintf(final, '%f %f\n', p);

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by