필터 지우기
필터 지우기

How can I save a big Matrix in text file without scientific notation?

조회 수: 4 (최근 30일)
Hello everybody,
I have a big Matrix (±2000,±5000) and I want to save it in a textfile. Therefore I used dlmwrite, but in some cases Matlab uses scientific format what I don't want. The matrix entries are of different format (integer, floating, negative, big and small numbers, also NaNs). That's why it is not useful for me, to save all entries with the same format (like wit 'precision'). And as I have a lot of columns and the order might change in different runs, i can not specify a format for each column while saving like in fprintf.
What I want is Matlab to save every entry as it does automatically with dlmwrite, but prevent saving numbers in scientific format.
Is there any possibility to realize that?
Thanks for your help!

채택된 답변

Walter Roberson
Walter Roberson 2012년 8월 27일
No.
By default, dlmwrite() uses a %g format for numeric values. There is no way to prevent %g from using scientific notation.
%g is the only formatting code that automatically chooses representation.
If you find that it is unsuitable to pass a %f format to dlmwrite(), then your only choice is to create the format on the fly, having determined some-how how you want to write each item.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by