Why it shows that index exceeds the number of array elements???

1 visualización (últimos 30 días)
ANJUSHA AK
ANJUSHA AK el 4 de Mzo. de 2021
Respondida: Cris LaPierre el 4 de Mzo. de 2021
%Statistics
areas = [5176 5183 5165]
area_mean= mean(areas)
area_var= var(areas)
area_std= std(areas)

Respuestas (1)

Cris LaPierre
Cris LaPierre el 4 de Mzo. de 2021
You must have a variable defined as either mean, var, or std. Clear your workspace and try again.
areas = [5176 5183 5165];
area_mean= mean(areas)
area_mean = 5.1747e+03
area_var= var(areas)
area_var = 82.3333
area_std= std(areas)
area_std = 9.0738
% Now to recreate the error by replacing the function 'mean' with a variable
mean = 5
mean = 5
area_mean= mean(areas)
Index exceeds the number of array elements (1).

'mean' appears to be both a function and a variable. If this is unintentional, use 'clear mean' to remove the variable 'mean' from the workspace.

Categorías

Más información sobre Matrix Indexing 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