problem using fprintf for writing matrix into microsoft office word.

matrix=[0.13 0.14;0.09 0.07;0.86 0.77]
[fileName, filePath] = uiputfile('*.doc', 'Create a file:')
if ~ischar(fileName)
return
end
fileID = fopen(fullfile(filePath, fileName), 'w');
fprintf(fileID,'%45f\n',matrix)
%in doc file, the matrix created one column and six rows.
0.130000
0.090000
0.860000
0.140000
0.070000
0.770000
%how can I fix this matrix as two columns and three rows?
%it supposed to be;
0.130000000000000 0.140000000000000
0.090000000000000 0.070000000000000
0.860000000000000 0.770000000000000

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 3일
편집: Azzi Abdelmalek 2013년 8월 3일
fileID = fopen('fic.txt', 'w');
fprintf(fileID,'%.15f %.15f \n',matrix')
fclose(fileID)

댓글 수: 1

could you try to answer my other question which is still unanswered

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by