Let two vectors lo and hi be given.
The job is to create a index vector like so
idx = [lo(1):hi(1) lo(2):hi(2) ...]
Where : is the colon operator.
One can assume that all entries are positve integers. Delete all pairs where lo(i) > hi(i).
idx = [1 2 3 5 6 7 8 10 11 12]
idx = [6 7 8]
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry PiLearn more
Opportunities for recent engineering grads.Apply Today
New to MATLAB?Learn MATLAB today!
Play games and win prizes!Learn more