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

1 view (last 30 days)
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?

Accepted Answer

Walter Roberson
Walter Roberson on 6 Sep 2019
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.

More Answers (0)

Categories

Find more on Data Import and Export 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!