Undefined function 'sum' for input arguments of type 'struct' and Error in std.
古いコメントを表示
Problem 1:
Undefined function 'sum' for input arguments of type 'struct':
Error in var: xbar = sum(x, dim) ./ n;
Note: I have enter into command window:
1) class(x)and got:
>> class(x)
ans =
struct
2) class(dim)and got:
>> class(dim) Undefined function or variable 'dim'. Why does class(dim) not work? -------------------------------------------------------------------------------------- Problem 2:
Error in std:
y = sqrt(var(varargin{:}));
I do not understand why the error occurs. What would be most likely reasons and how to sort it out? ------------------------------------------------------------------------------------- Many thanks for any help and guidance!
3 件のコメント
"Why does class(dim) not work?" Because dim is not a variable in your workspace. It is the name of an optional input argument to the function sum.
"I do not understand why the error occurs"
Please show us the complete error message. This means all of the red text.
Massilon Toniolo da Silva
2017 年 5 月 19 日
Adam
2017 年 5 月 19 日
doc struct
will tell you about structs, which are just containers for a heap of variables (fields as they are called, for structs). You must know what data you actually want to use though. Clearly you don't want to use the struct in your maths so just access whichever of its fields is the one you want.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Live Scripts and Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!