Undefined function 'double' for input arguments of type 'table'. To convert to numeric, use the TABLE2ARRAY function, or extract data using dot or brace subscripting.
27 ビュー (過去 30 日間)
古いコメントを表示
Hi,
What am I doing wrong here ?? and how would I correct it?
Code:
LSDMag_DesignPoint = ['F:\3-PIV_Experimental_Data\Calculations_TurbulentIntensity\Point_Data\Below_Outlet_LSD\Length\DesignPoint\110_outlet\Export.70m6itdj.000000.csv'];
DesignPoint = readtable(LSDMag_DesignPoint);
TurbulentFluctuation = DesignPoint(:,2);
TurbulentFluctuation_SquareRoot = (TurbulentFluctuation)^2;
Error:
Error using tabular/double (line 210)
Undefined function 'double' for input arguments of type 'table'. To convert to numeric, use the TABLE2ARRAY function, or extract data using dot or brace subscripting.
Error in ^ (line 43)
X = double(X);
0 件のコメント
採用された回答
Steven Lord
2022 年 6 月 8 日
The ^ operator appears to be trying to convert its input into a double precision value, but because a table array can contain any type of data (not just numeric but also text, categorical, etc.) that conversion is not defined.
On the line immediately before you attempt to square TurbulentFluctuation you should extract the contents of the table column using curly braces not the table column itself using parentheses.
A = array2table(magic(5)) % A is a table
st = A(:, 2) % st is also a table
d = A{:, 2} % d is a double array
You can square the elements of d using the .^ (element-wise power) operator [note: not the ^ (matrix power) operator] but you can't square the elements of st. That operator is not defined for table arrays.
y = d.^2 % works
z = st.^2 % error
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!