problem using fprintf for writing matrix into microsoft office word.
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Azzi Abdelmalek
2013-8-3
编辑:Azzi Abdelmalek
2013-8-3
fileID = fopen('fic.txt', 'w');
fprintf(fileID,'%.15f %.15f \n',matrix')
fclose(fileID)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!