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 177287

Submitted on 14 Dec 2012 by eric landiech

Correct

33Size
Leading solution size is 12.
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
 
%% case 1
VecStart= [10 20 30 40 50 ];
VecEnd = [11 22 33 44 50];
y_correct = [10 11 20 21 22 30 31 32 33 40 41 42 43 44 50];
assert(isequal(vec_colon(VecStart,VecEnd ),y_correct))
z =
    10    11
z =
    10    11    20    21    22
z =
    10    11    20    21    22    30    31    32    33
z =
    10    11    20    21    22    30    31    32    33    40    41    42    43    44
z =
    10    11    20    21    22    30    31    32    33    40    41    42    43    44    50
2
Pass
 
%% case 2
VecStart= [2 10 5 15 10 5 2 100 ];
VecEnd = [3 10 6 17 12 7 3 102];
y_correct = [2 3 10 5 6 15 16 17 10 11 12 5 6 7 2 3 100 101 102];
assert(isequal(vec_colon(VecStart,VecEnd ),y_correct))
z =
     2     3
z =
     2     3    10
z =
     2     3    10     5     6
z =
     2     3    10     5     6    15    16    17
z =
     2     3    10     5     6    15    16    17    10    11    12
z =
     2     3    10     5     6    15    16    17    10    11    12     5     6     7
z =
     2     3    10     5     6    15    16    17    10    11    12     5     6     7     2     3
z =
  Columns 1 through 16
     2     3    10     5     6    15    16    17    10    11    12     5     6     7     2     3
  Columns 17 through 19
   100   101   102
3
Pass
 
%% case 3
VecStart = [1:10:500];
VecEnd = [10:10:500];
y_correct = [1:500];
assert(isequal(vec_colon(VecStart,VecEnd ),y_correct))
z =
     1     2     3     4     5     6     7     8     9    10
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 20
    17    18    19    20
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 30
    17    18    19    20    21    22    23    24    25    26    27    28    29    30
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 40
    33    34    35    36    37    38    39    40
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 50
    49    50
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 60
    49    50    51    52    53    54    55    56    57    58    59    60
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 70
    65    66    67    68    69    70
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 90
    81    82    83    84    85    86    87    88    89    90
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96
  Columns 97 through 100
    97    98    99   100
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96
  Columns 97 through 110
    97    98    99   100   101   102   103   104   105   106   107   108   109   110
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96
  Columns 97 through 112
    97    98    99   100   101   102   103   104   105   106   107   108   109   110   111   112
  Columns 113 through 120
   113   114   115   116   117   118   119   120
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96
  Columns 97 through 112
    97    98    99   100   101   102   103   104   105   106   107   108   109   110   111   112
  Columns 113 through 128
   113   114   115   116   117   118   119   120   121   122   123   124   125   126   127   128
  Columns 129 through 130
   129   130
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96
  Columns 97 through 112
    97    98    99   100   101   102   103   104   105   106   107   108   109   110   111   112
  Columns 113 through 128
   113   114   115   116   117   118   119   120   121   122   123   124   125   126   127   128
  Columns 129 through 140
   129   130   131   132   133   134   135   136   137   138   139   140
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96
  Columns 97 through 112
    97    98    99   100   101   102   103   104   105   106   107   108   109   110   111   112
  Columns 113 through 128
   113   114   115   116   117   118   119   120   121   122   123   124   125   126   127   128
  Columns 129 through 144
   129   130   131   132   133   134   135   136   137   138   139   140   141   142   143   144
  Columns 145 through 150
   145   146   147   148   149   150
z =
  Columns 1 through 16
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16
  Columns 17 through 32
    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32
  Columns 33 through 48
    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48
  Columns 49 through 64
    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64
  Columns 65 through 80
    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80
  Columns 81 through 96
    81    82    83    84    85    86    87    88    89    90    91    92 ...