MATLAB Answers

Find indices in accumarray syntax

4 views (last 30 days)
How can I find the indices in the accumarray syntax below, Thanks in advance
accumarray(OrbNO,elev,[],@(x) max(x)-min(x), 0);
  1 Comment
Oday Shahadh
Oday Shahadh on 10 Jan 2017
You are great Walter.. Thanks

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Jan 2017
function idx = maxidx(x)
[~, idx] = max(x);
function idx = minidx(x)
[~, idx] = min(x);
Together with
accumarray(OrbNO,elev,[],@(x) maxidx(x)-minidx(x), 0);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!