필터 지우기
필터 지우기

How to compute the speed from the following dat file

조회 수: 1 (최근 30일)
JD_PM
JD_PM 2022년 5월 19일
댓글: JD_PM 2022년 5월 19일
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