Cody

# Problem 794. Matrix with different incremental runs

Solution 1300216

Submitted on 19 Oct 2017 by Marcial Guerra
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a = [ 3 2 4 ]; b = [ 1 1 1 2 2 2 3 0 3 0 0 4 ]; assert(isequal(your_fcn_name(a),b))

M = 0 0 0 0 0 0 0 0 0 0 0 0 M = 1 0 0 0 0 0 0 0 0 0 0 0 M = 1 0 0 2 0 0 0 0 0 0 0 0 M = 1 0 0 2 0 0 3 0 0 0 0 0 M = 1 1 0 2 0 0 3 0 0 0 0 0 M = 1 1 0 2 2 0 3 0 0 0 0 0 M = 1 1 1 2 2 0 3 0 0 0 0 0 M = 1 1 1 2 2 2 3 0 0 0 0 0 M = 1 1 1 2 2 2 3 0 3 0 0 0 M = 1 1 1 2 2 2 3 0 3 0 0 4

2   Pass
a = [1 0 8 9 14]; b =[ 1 0 1 1 1 0 0 2 2 2 0 0 3 3 3 0 0 4 4 4 0 0 5 5 5 0 0 6 6 6 0 0 7 7 7 0 0 8 8 8 0 0 0 9 9 0 0 0 0 10 0 0 0 0 11 0 0 0 0 12 0 0 0 0 13 0 0 0 0 14]; assert(isequal(your_fcn_name(a),b))

M = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 M = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 M = 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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0 0 3 0 0 4 0 0 M = 1 1 0 2 2 0 3 0 0 4 0 0 M = 1 1 1 2 2 0 3 0 0 4 0 0 M = 1 1 1 2 2 2 3 0 0 4 0 0 M = 1 1 1 2 2 2 3 0 3 4 0 0 M = 1 1 1 2 2 2 3 0 3 4 0 4

4   Pass
a= 1; assert(isequal(your_fcn_name(a),1))

M = 0 M = 1

5   Pass
a = []; assert(isequal(your_fcn_name(a),[]))

M = []

### Community Treasure Hunt

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

Start Hunting!