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

2 vues (au cours des 30 derniers jours)
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?

Réponse acceptée

Walter Roberson
Walter Roberson le 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.

Plus de réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by