Effacer les filtres
Effacer les filtres

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

70 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Kim
Kim le 4 Fév 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

Plus de réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 4 Fév 2013
Modifié(e) : Azzi Abdelmalek le 4 Fév 2013
x=rand(513,86);
a=x(200:400,:);
min1=min(a(:))
max1=max(a(:))
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 5 Fév 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]);

Connectez-vous pour commenter.


Mohammadhassan safavi
Mohammadhassan safavi le 30 Oct 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);

Catégories

En savoir plus sur Calendar dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by