Undefined function 'sum' for input arguments of type 'struct' and Error in std.
Mostrar comentarios más antiguos
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 comentarios
"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
el 19 de Mayo de 2017
Adam
el 19 de Mayo de 2017
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Live Scripts and Functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!