Mean and identification values
Mostrar comentarios más antiguos
Hi Matlab Community,
I would to identify a specific number in an array, and change its value to the average of the previous and later data, I wrote the follow code, but it shows the error:
d= table2array(d);
[matriz_media,q,instrumento,ano_ini] = gerar_medias(d54);
matriz_media = matriz_media(1:q,3:instrumento);
X = matriz_media;
[l,c]=size(matriz_media)
for w=1:c
for q = 1:l
if matriz_media(q,w)==999999 % Identify this number in the matrix
matriz_media(q,w)= mean([matriz_media((q-1),(w-1)),matriz_media((q+1),(w+1))]); % Change the number 999999 to mean between element previous and subsequent.
end
end
end
Index in position 2 is invalid. Array indices must be positive integers or logical values.
Error in DEPURACAO_SEGUNDA_FASE (line 13)
matriz_media(q,w)= mean([matriz_media((q-1),(w-1)),
matriz_media((q+1),(w+1))]);
Thank you very much
Guilherme
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Descriptive Statistics 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!