Analyzing different sections of an array

2 visualizaciones (últimos 30 días)
L'O.G.
L'O.G. el 27 de Nov. de 2022
Respondida: Jan el 27 de Nov. de 2022
How do you analyze the first 10 columns of an array (all rows) and columns 11-20, 21-30, and so on, separately?

Respuesta aceptada

Jan
Jan el 27 de Nov. de 2022
Either reshape the array:
x = rand(20, 100);
y = reshape(x, 20, 10, 10);
m = mean(x, 2); % If you want the mean value over block of 10 columns
or use a loop:
for k = 1:10:100
a = k;
b = k + 9;
process(x(:, a:b));
end

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by