Searching the minimum element of an array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi..I have a question: if I have the result of a wavread, an array of samples, and I want to search the minimum element only between the last hundred elements and its index, how I can do this? I have some problems with the indices.
Akzeptierte Antwort
Azzi Abdelmalek
am 18 Sep. 2012
Bearbeitet: Azzi Abdelmalek
am 18 Sep. 2012
v=rand(150,1)
[a0,idx0]=min(v(end-100:end))
% a0 your min
% idx0 corresponding index
Weitere Antworten (2)
HSO
am 18 Sep. 2012
array=rand(20,1)
[L C] =size(a)
lower=min(a((L-10):end))
2 Kommentare
Javier
am 18 Sep. 2012
Bearbeitet: Javier
am 18 Sep. 2012
Hello Micaela
Step 1 Data
Data=randn(100,1);
Step 2 Find the min in Data
Index = 10; %Search in the last 10 data
x=min(Data((length(Data)-Index):end,:));
Step 3
Description row, column, index of min data
[r,c,v]= find(Data==x);
In this case, r=row vector; c=column vector; v=index value
Hope it helps.
Javier
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!