Import numerical data from .dat file maintaining small values (instead of 0's)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jasmine Alvarez
am 6 Sep. 2019
Beantwortet: Walter Roberson
am 6 Sep. 2019
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?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 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.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Workspace Variables and MAT Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!