Comparison is equal, why assertion is failed?
The output should be an array not a table.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
N = 5
load(fullfile(matlabroot, 'toolbox/stats/statsdemos', 'carbig.mat'));
Model = strtrim(string(Model));
cars = table(Model, MPG, Horsepower, Weight, Acceleration);
save cars.mat cars
assert(isequal(sort_cars(N),[35; 31; 39.1; 35.1; 31]));
N =
5
mpg =
5x1 table
<strong>MPG</strong>
<strong>____</strong>
35
31
39.1
35.1
31
|
2 | Fail |
N = 6
load(fullfile(matlabroot, 'toolbox/stats/statsdemos', 'carsmall.mat'));
Model = strtrim(string(Model));
cars = table(Model, MPG, Horsepower, Weight, Acceleration);
save cars.mat cars
assert(isequal(sort_cars(N),[33; 29.5; 26; 29; 38; 32]));
N =
6
mpg =
6x1 table
<strong>MPG</strong>
<strong>____</strong>
33
29.5
26
29
38
32
|
Back to basics 8 - Matrix Diagonals
781 Solvers
Create an n-by-n null matrix and fill with ones certain positions
268 Solvers
convert matrix to single column
306 Solvers
2770 Solvers
281 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!