Out of memory error
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 29 Oct 2020
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.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!