How to write a for loop to look at the rows of a M X N matrix?
Mostrar comentarios más antiguos
i Have a M X N matrix, and I need to divide the rows to n =130 data points and find the max value in that, and then move down the row by (n+1):2n,(2n+1):3n.. until the end, and I need to repeat this iteration for all the columns in the data, and save the data alongside the row number. could you please help me with this. the code which I have written is below:
*newdepth corresponds to length of my data in mm, and the input function asks me to scan the data for a desired depth.
section = input('Size of section (mm): ');
sectionrows = (section*(rsize))/(newdepth);
sectionrows=round(sectionrows);
Row= [];
nsections = (rsize/sectionrows);
nsections =round(nsections);
for k = 1:sectionrows
for i = 1:nsections
Vmax = max(max(hil1(k+(i-1)*sectionrows,:))); % Reflected maximum voltage amplitude from normal tissue
Row=[Row Vmax];
end
end
Respuesta aceptada
Más respuestas (1)
data = rand(10019, 824);
[row, col] = size(data);
len = floor(row / 200);
block = reshape(data(1:len * 200, :), 200, len, col);
result = squeeze(max(block, [], 1));
1 comentario
Srikanta Sharma
el 24 de Ag. de 2012
Categorías
Más información sobre Time Series 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!