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

조회 수: 75 (최근 30일)
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

채택된 답변

Kim
Kim 2013년 2월 4일
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

추가 답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 4일
편집: Azzi Abdelmalek 2013년 2월 4일
x=rand(513,86);
a=x(200:400,:);
min1=min(a(:))
max1=max(a(:))
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 5일
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
Mohammadhassan safavi 2018년 10월 30일
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);

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by