Cody

Problem 619. Multiply a column by a row

Solution 3037060

Submitted on 2 Oct 2020
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
C=[4; 1; 2]; R=[2 3 5]; M=[8 12 20; 2 3 5; 4 6 10]; assert(isequal(mul(C,R),M));

Unrecognized function or variable 'B'. Error in mul (line 2) for ii = 10:-1:1,M{ii} = B(:,ii)*A(ii,:);end Error in Test1 (line 4) assert(isequal(mul(C,R),M));

2   Fail
C=[1; 1; 1]; R=[1 1]; M=ones(3,2); assert(isequal(mul(C,R),M));

Unrecognized function or variable 'B'. Error in mul (line 2) for ii = 10:-1:1,M{ii} = B(:,ii)*A(ii,:);end Error in Test2 (line 4) assert(isequal(mul(C,R),M));

3   Fail
C=[1;2;3;0]; R=[7,2]; M=[7 2; 14 4; 21 6; 0 0]; assert(isequal(mul(C,R),M));

Unrecognized function or variable 'B'. Error in mul (line 2) for ii = 10:-1:1,M{ii} = B(:,ii)*A(ii,:);end Error in Test3 (line 4) assert(isequal(mul(C,R),M));

Suggested Problems

More from this Author100

Community Treasure Hunt

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

Start Hunting!