How to compute the speed from the following dat file

1 次查看(过去 30 天)
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 个评论
JD_PM
JD_PM 2022-5-19
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by