How do I find a min/max value within a defined range for each column of a matrix?
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (2)
Azzi Abdelmalek
il 4 Feb 2013
Modificato: Azzi Abdelmalek
il 4 Feb 2013
x=rand(513,86);
a=x(200:400,:);
min1=min(a(:))
max1=max(a(:))
1 Commento
Azzi Abdelmalek
il 5 Feb 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]);
Mohammadhassan safavi
il 30 Ott 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);
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!