Cody

# Problem 42845. generate number in particular way

Solution 1827337

Submitted on 27 May 2019
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   Fail
a = [1 5 2 7]; m = 10; y_correct = [1 2 2 2 2 2 3 3 4 4]; assert(isequal(your_fcn_name(a,m),y_correct))

Unable to perform assignment because the left and right sides have a different number of elements. Error in your_fcn_name (line 5) y(i:a(i)+1) = i * ones(1,a(i)); Error in Test1 (line 5) assert(isequal(your_fcn_name(a,m),y_correct))

2   Fail
a = [2 3 2 7 4 6]; m = 22; y_correct = [1 1 2 2 2 3 3 4 4 4 4 4 4 4 5 5 5 5 6 6 6 6]; assert(isequal(your_fcn_name(a,m),y_correct))

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. Error in your_fcn_name (line 5) y(i:a(i)+1) = i * ones(1,a(i)); Error in Test2 (line 5) assert(isequal(your_fcn_name(a,m),y_correct))

3   Fail
a = ones(1,100); m = 42; y_correct = 1:42; assert(isequal(your_fcn_name(a,m),y_correct))

Assertion failed.

4   Fail
a = [3 1 2 6 1]; m = 13; y_correct = [1 1 1 2 3 3 4 4 4 4 4 4 5]; assert(isequal(your_fcn_name(a,m),y_correct))

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. Error in your_fcn_name (line 5) y(i:a(i)+1) = i * ones(1,a(i)); Error in Test4 (line 5) assert(isequal(your_fcn_name(a,m),y_correct))

5   Fail
a = 1:10; m = 20; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6]; assert(isequal(your_fcn_name(a,m),y_correct))

Unable to perform assignment because the left and right sides have a different number of elements. Error in your_fcn_name (line 5) y(i:a(i)+1) = i * ones(1,a(i)); Error in Test5 (line 5) assert(isequal(your_fcn_name(a,m),y_correct))

6   Fail
a = [3 1 4 1 5 2]; m = 13; y_correct = [1 1 1 2 3 3 3 3 4 5 5 5 5]; assert(isequal(your_fcn_name(a,m),y_correct))

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. Error in your_fcn_name (line 5) y(i:a(i)+1) = i * ones(1,a(i)); Error in Test6 (line 5) assert(isequal(your_fcn_name(a,m),y_correct))

### Community Treasure Hunt

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

Start Hunting!