Clear Filters
Clear Filters

position of set bits in a vector in matlab

1 view (last 30 days)
hi Is there a command that could tell me which bits are set in a vector?
example x=[0 1 0 1 1 0 1]
required output: y=[2 4 5 7]
much appreciated!!!!

Accepted Answer

Walter Roberson
Walter Roberson on 26 Feb 2013
y = find(x);

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!