mean value of array after every n columns
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Fatma Nur Disci
el 8 de Dic. de 2020
Editada: Fatma Nur Disci
el 16 de Dic. de 2020
Hi,
I have 1x131072 dataPower array read from matfile. And want to average each every 128 columns. What's the problem here ?
a = matfile('x');
b=a.dataPower; %dataPower array
bround=round(b(1:131072) % array include double values like 297.3865 and just try to cast to 297 for example.
for i = 1024
k(i) = mean(bround((i-1)*128+1:i*128),2)
end
And want to get 1024 value. But error : subscript indices must either be real positive integers or logicials.
Thanks.
0 comentarios
Respuesta aceptada
Ameer Hamza
el 8 de Dic. de 2020
Here is a loop-free option
a = matfile('x');
b=a.dataPower; %dataPower array
bround=round(b(1:131072));
k = mean(reshape(bround, 128, []))
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Types en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!