targeting a single piece of data from an array
古いコメントを表示
I have an array of values, 5 columns, 30 rows. Trying to get a min and max from the array, but all that gets returned is the whole row of data, being the row with the lowest values, and the row with the highest values. what i need is the single lowest value and single highest value.
Thanks.
回答 (2 件)
Andrei Bobrov
2013 年 2 月 27 日
[z,ii] = min(x(:));
[rws,cls] = ind2sub(size(x),ii);
Honglei Chen
2013 年 2 月 27 日
min(min(x))
and
max(max(x))
Or
min(x(:))
and
max(x(:))
2 件のコメント
Tyler
2013 年 2 月 27 日
Honglei Chen
2013 年 2 月 27 日
There are two ways to do this. One way is to do as @Andrei showed above, or you can do this in two steps as I show below
[temp,weekidx] = min(x);
[y,minYear] = min(temp);
minWeek = weekidx(minYear)
カテゴリ
ヘルプ センター および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!