How to obtain a vector of indices using loop

1 view (last 30 days)
juan sanchez
juan sanchez on 15 Sep 2019
Edited: dpb on 15 Sep 2019
Hi, I have a 10,000 row x 16 column x numFiles pages corresponding to time x heights x horizontal distances representing the measurements of mean speed Vmean speed in a 3D cell array.
If I want to get the maximum value index all I have to do is type: Vmax all=[V_max_all,I] = max(abs(V_mean(:))
where I is the linear index location that correspond to Vmax inside the total Vmean array.
Then in order to extract the subscripts for this Vmax inside the array I use:
[I_time, I_station, I_file] = ind2sub(size(V_mean),I)
On the other hand, I also have Venvelope = (Vmax1;Vmax2;Vmax3;...Vmmax16) where Venv is a 16 row x numfile column,
Therefore, I want to obtain a loop from which I can obtain a vector with the indices for each corresponding height
for i=1:16
for j=1:numfiles
[I_time, I_station, I_file] = ind2sub(size(V_mean(time, i,j)),I)
....
so I could obtain the vector [I_time, I_station, I_file] corresponding to each Vmax1;Vmax2,...)

Answers (0)

Community Treasure Hunt

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

Start Hunting!