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!