How to find indices from a vector for values added in an array?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have an array 'Ru' with 3 columns and 146k values (wave timeseries) each, which correspond to 50 years of measurements. I have another array 'YearLimits' (50x2) which has the time limits for each year' measurements. The 1st column has the index of the 1st measurement and the 2nd column the index of the last measurment of each year.
YearLimits=[1 2911
2912 5831
5832 8759
8760 11679
11680 14599
14600 17519
..........]
I needed to extract the max values for each year from Ru and the corresponding indices. I check each column separately. I managed the 1st one, but I need help help for the 2nd task :). My code is:
MaxVal=zeros(length(YearLimits),3);
for i=1:length(YearLimits)
for j=1:3
MaxVal(i,j)=max(Ru(YearLimits(i,1):YearLimits(i,2),j));
end
end
So how can I add the corresponding indices into the MaxVal array or extract them in another one??
PS: I need the indices from the Ru array that follows the numbers in the MaxVal array.
For example The MaxVal(1,1)=1,5 has an index in Ru equal to 1822.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!