1 addpath('~/matlab_xunit/xunit/') assertEqual(true, true) runtests assertTrue(true) assertFalse(false) assertAlmostEqual(1, 1.00000001) assertElementsAlmostEqual(1, 1.00000001) squared(2) squared(4) assertEqual(area(10, 5), 50) assertEqual(area(10, 6), 50) assertEqual(area(10, 5), 50) assertTrue(divisible(6, 3)) true false assertTrue(divisible(6, 3)) assertTrue(divisible(5, 3)) assertEqual(monus(4, 98798797), 0) assertEqual(monus(4, 2), 2) assertEqual(monus(4, 1), 2) [1 2 3] [1 2 3; 4 5 6] [1 2 3; 4 5 6 7] [1 2 4] size([1 2 4]) x = [1 2 4] y = [x, 5] [] 0:[1, 2, 3] 0:1 [1, 2, 3] + 4 square_list([2, 4, 6]) assertEqual(factorial(6), 720) [1 2 4] + 3 [1 2 4] * 3 [1 2 4] / 3 [1 2 4] - 3 [1 2 4] ^ 2 [1 2 4] .^ 2 [1 2 4] .+ 2 [1 2 4] .* 2 [1 2 4] * 2 [1 2 4] .* [2 4 6] [1 2 4] * [2 4 6] [1 2 4] * [2; 4; 6] A = [1 2 3; 6 7 8; 20 30 40] A .^2 A A .^ 2 A ^ 2 A(2:) A(2:, :) A(:, :) A(:1, :) A(:1) %can't leave off just one bound in MATLAB A(1:2) A(1:2, :) A(1:2, 1:2) A A' any(A) all(A) A(1, :) any(A(1, :)) [1 0 0; 0 1 0; 0 0 1] Ident = [1 0 0; 0 1 0; 0 0 1] any(Ident) all(Ident) diag(A) A ans = 1 ??? Error using ==> runtests at 100 No test cases found. ??? Undefined function or method 'assertAlmostEqual' for input arguments of type 'double'. ??? Undefined function or method 'squared' for input arguments of type 'double'. ??? Undefined function or method 'squared' for input arguments of type 'double'. ??? Inputs are not equal. First input: 171.0016 Second input: 50 ??? Inputs are not equal. First input: 171.0022 Second input: 50 ??? Inputs are not equal. First input: 171.0028 Second input: 50 ??? Undefined function or method 'divisible' for input arguments of type 'double'. ans = 1 ans = 0 ??? Undefined function or method 'divisible' for input arguments of type 'double'. ??? Undefined function or method 'divisible' for input arguments of type 'double'. ??? Undefined function or method 'monus' for input arguments of type 'double'. ??? Undefined function or method 'monus' for input arguments of type 'double'. ??? Undefined function or method 'monus' for input arguments of type 'double'. ans = 1 2 3 ans = 1 2 3 4 5 6 ??? Error using ==> vertcat CAT arguments dimensions are not consistent. ans = 1 2 4 ans = 1 3 x = 1 2 4 y = 1 2 4 5 ans = [] ans = 0 1 ans = 0 1 ans = 5 6 7 ??? Undefined function or method 'square_list' for input arguments of type 'double'. ans = 4 5 7 ans = 3 6 12 ans = 0.3333 0.6667 1.3333 ans = -2 -1 1 ??? Error using ==> mpower Matrix must be square. ans = 1 4 16 ??? [1 2 4] .+ 2 | Error: Unexpected MATLAB operator. ans = 2 4 8 ans = 2 4 8 ans = 2 8 24 ??? Error using ==> mtimes Inner matrix dimensions must agree. ans = 34 A = 1 2 3 6 7 8 20 30 40 ??? Error: "A" was previously used as a variable, conflicting with its use here as the name of a function or command. See MATLAB Programming, "How MATLAB Recognizes Function Calls That Use Command Syntax" for details. A = 1 2 3 6 7 8 20 30 40 ans = 1 4 9 36 49 64 400 900 1600 ans = 73 106 139 208 301 394 1000 1450 1900 ??? A(2:) | Error: Unbalanced or unexpected parenthesis or bracket. ??? A(2:, :) | Error: Expression or statement is incorrect--possibly unbalanced (, {, or [. ans = 1 2 3 6 7 8 20 30 40 ??? A(:1, :) | Error: Unexpected MATLAB expression. ??? A(:1) | Error: Unexpected MATLAB expression. ans = 1 6 ans = 1 2 3 6 7 8 ans = 1 2 6 7 A = 1 2 3 6 7 8 20 30 40 ans = 1 6 20 2 7 30 3 8 40 ans = 1 1 1 ans = 1 1 1 ans = 1 2 3 ans = 1 ans = 1 0 0 0 1 0 0 0 1 Ident = 1 0 0 0 1 0 0 0 1 ans = 1 1 1 ans = 0 0 0 ans = 1 7 40 A = 1 2 3 6 7 8 20 30 40