フィルターのクリア

The format type of reading a matrix from a file?

1 回表示 (過去 30 日間)
Rahim Rahim
Rahim Rahim 2020 年 12 月 20 日
回答済み: Cris LaPierre 2020 年 12 月 20 日
I saved a matrix in a file.txt; the type of matrix is as follow:
file: 0.010993,0.21973,0.012142,0.49897,0.24634,0.01183
When I open the matrix by using
Matrix= dlmread( 'File.txt') ) ;
The matlab take only 4 number after the point, where Matrix:
Matrix: 0.0110 0.2197 0.0121 0.4990 0.2463 0.0118
I don't want to change the numbers after the matrix.

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 20 日
I suspect the full values are there. However, by default MATLAB only displays 4 decimal places. If you look at the original and displayed values, you can see they've been rounded to 4 decimal places. However, the full value is still there. This is just a display thing.
You can modify the command window output display using the format function. See the available options here.

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by