Out of memory error

3 ビュー (過去 30 日間)
Najam us Saqib Fraz
Najam us Saqib Fraz 2020 年 10 月 29 日
回答済み: Walter Roberson 2020 年 10 月 29 日
My data looks like this in the picture.I am using textscan to scan the data.But sometimes when the data is little bit larger it gives me error of less memory.If you see the picture each number is multiple decimal places which I do not need.Is there any way I can read the data having having three digits after the decmal.This will also remove the memory error.I am using Matlab 2015a.Thank You

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 10 月 29 日
No. If you have any digits after the decimal point, then you are using floating point numbers, and floating point numbers do not use less storage if you have fewer decimal digits. The storage required for 3.0 is the same as for 3.5 is the same as for 3.25 is the same as 3.125 is the same as 3.14159265 -- 8 bytes in each case for double precision values.
What you can do is switch from using '%f' format to using '%f32' format. %f32 uses single precision values, which take only 4 bytes (32 bits) instead of 8 bytes (64 bits). This will use only half as much storage.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by