Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 431622

Submitted on 14 Apr 2014 by James

Correct

23Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x = 1;
y_correct = 'I';
assert(isequal(your_fcn_name(x),y_correct))
d =
  Columns 1 through 8
        1000         900         500         400         100          90          50          40
  Columns 9 through 13
          10           9           5           4           1
r =
    'M'    'CM'    'D'    'CD'    'C'    'XC'    'L'    'XL'    'X'    'IX'    'V'    'IV'    'I'
ans =
     []
2
Pass
 
%%
x = 98;
y_correct = 'XCVIII';
assert(isequal(your_fcn_name(x),y_correct))
d =
  Columns 1 through 8
        1000         900         500         400         100          90          50          40
  Columns 9 through 13
          10           9           5           4           1
r =
    'M'    'CM'    'D'    'CD'    'C'    'XC'    'L'    'XL'    'X'    'IX'    'V'    'IV'    'I'
ans =
     []
3
Pass
 
%%
x = 501;
y_correct = 'DI';
assert(isequal(your_fcn_name(x),y_correct))
d =
  Columns 1 through 8
        1000         900         500         400         100          90          50          40
  Columns 9 through 13
          10           9           5           4           1
r =
    'M'    'CM'    'D'    'CD'    'C'    'XC'    'L'    'XL'    'X'    'IX'    'V'    'IV'    'I'
ans =
     []
4
Pass
 
%%
x = 867;
y_correct = 'DCCCLXVII';
assert(isequal(your_fcn_name(x),y_correct))
d =
  Columns 1 through 8
        1000         900         500         400         100          90          50          40
  Columns 9 through 13
          10           9           5           4           1
r =
    'M'    'CM'    'D'    'CD'    'C'    'XC'    'L'    'XL'    'X'    'IX'    'V'    'IV'    'I'
ans =
     []