Filter löschen
Filter löschen

How to compute the speed from the following dat file

1 Ansicht (letzte 30 Tage)
JD_PM
JD_PM am 19 Mai 2022
Kommentiert: JD_PM am 19 Mai 2022
I want to compute the magnitude of the velocity;data file: surfaceFieldValue1eNEG06.dat https://drive.google.com/drive/folders/1CgeDuCahVZvLXXkNkGWlPg8lSGyurmI3
I run the following code
A = readtable("surfaceFieldValue1eNEG06.dat");
Ux_8 = A{:,"areaAverage_rho_"};
Uy_8 = A{:,"areaAverage_U_"};
Uz_8 = A{:,"areaAverage_p_"};
U_8 = sqrt(Ux_8.^2 + Uy_8.^2 + Uz_8.^2)
However, this yields the following error
Operator '.^' is not supported for operands of type 'cell'.
Error in speedPressure8Inlet (line 12)
U_8 = sqrt(Ux_8.^2 + Uy_8.^2 + Uz_8.^2)
I tried to use readmatrix instead of readtable but then x and z velocity components yield NaN type.
I think the main issue is that for Ux, Uz I have {''} characters. If they were not to be there there would not be a problem.
  1 Kommentar
JD_PM
JD_PM am 19 Mai 2022
Resolved: remove the braces from the original text file using, say, notepad (ctrl h and replace '(' by space) . So it was not a problem of Matlab actually.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Tables 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!

Translated by