Borrar filtros
Borrar filtros

How to get the mean of a vector ?

1 visualización (últimos 30 días)
Elias Unk
Elias Unk el 17 de Jun. de 2017
Editada: dpb el 18 de Jun. de 2017
Trying to get the average of the 4 values in contrast by M=mean(cbr.contrast); and it's not working,also tried M= mean(cbr) didnn't work either and it's giving the following error Undefined function 'sum' for input arguments of type 'struct'.
Error in mean (line 115) y = sum(x, dim, flag)/size(x,dim);

Respuesta aceptada

dpb
dpb el 17 de Jun. de 2017
Editada: dpb el 18 de Jun. de 2017
M=mean(cbr.contrast);
Field names are case sensitive in Matlab; it's .Contrast'
NB: capitalization in the table of property names in the doc.
PS: If you just type the structure name at command line it will echo the field names and content summary that will also let you see the spelling and what they are. Or
fieldnames(theStructVariable)
returns them as cellstr array

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by