MATLAB: Import numerical data from .dat file maintaining small values (instead of 0’s)

.dat fileread filesmall digits

I am required to use the .dat files provided to us (for airfoils) in the code. However, when I use the code below, all of the x-coordinates are turned to 0's since they're all small numbers. How can I import them without MATLAB recognizing them as 0's? Further, why are only the x-coordinates appearing as 0's when the rest of the numbers are all quite small as well?
x = dlmread('NACA0012_5deg.dat',' ',3,0)
I attached a .csv file of the data because .dat files are not supported. If a .csv file will maintain the digits then how to convert .dat to .csv in matlab?

Best Answer

I recommend against using dlmread() for this purpose. I suggest
x = readmatrix('NACA0012_5deg.dat', 'filetype', 'text');
if you have R2019a or later. If you have an earlier release, then
x = table2array(readtable('NACA0012_5deg.dat', 'filetype', 'text'));
For your purposes you might want to remove the first column.
Related Question