Undefined function 'sum' for input arguments of type 'struct' and Error in std.
Mostra commenti meno recenti
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 Commenti
"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
il 19 Mag 2017
Adam
il 19 Mag 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.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Live Scripts and Functions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!