How do I find a min/max value within a defined range for each column of a matrix?

76 visualizaciones (últimos 30 días)
I am sure this is so simple but I can't work it out. I have a 513*86 array where the columns are the variables and the rows are the samples that represent a time series of EEG data sampled at 256 Hz. I want to find the maximum and minimum values between the 200th and 400th rows. I can't seem to make this work. Any help would be so appreciated! Thanks Kim

Respuesta aceptada

Kim
Kim el 4 de Feb. de 2013
Thank you so much for such a quick answer! I tried your code but I still have one problem.
I forgot to mention (sorry) I need it's index too. The code that I was using for one row of data was:
[minval,minindex] = min(meandata(N4index:P6index)); Where meandata is a vector representing a time averaged data series. The indexes are just time points found with the 'find' function but are about 200 and 400. I tried this
a=data(N4index:P6index,:); % isolate the section of interest? [min1,minindex]=min(a(:))
This returns a row vector of columns data, but it is the same number? Am I missing something?
Thanks again Kim

Más respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 4 de Feb. de 2013
Editada: Azzi Abdelmalek el 4 de Feb. de 2013
x=rand(513,86);
a=x(200:400,:);
min1=min(a(:))
max1=max(a(:))
  1 comentario
Azzi Abdelmalek
Azzi Abdelmalek el 5 de Feb. de 2013
x=rand(513,86);
a=x(200:400,:);
[min1,idx1]=min(a(:))
[max1,idx2]=max(a(:))
[ii1,jj1]=ind2sub([200 86],idx1)
[ii2,jj2]=ind2sub([200 86],idx2)
ii1=ii1+200;
ii2=ii2+200;
disp([min1,ii1,jj1]);
disp([max1 ii2 jj2]);

Iniciar sesión para comentar.


Mohammadhassan safavi
Mohammadhassan safavi el 30 de Oct. de 2018
here is the code: X is original data set, A is subset within the range
range =L:U;
A = X(range);
[value index]=max(A);
org_index= range(index);

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by