Multiply a column by a row - MATLAB Cody - MATLAB Central

Problem 619. Multiply a column by a row

Difficulty:Rate
  • Given a column vector C and and a row vector R.
  • Output a matrix M.
  • Every column of M equals to C multiplied by corresponding element of R.
  • Every row of M equals to R multiplied by corresponding element of C.
  • Try a general solution, the test suite may change.

Example:

 C=[4; 1; 2];
 R=[2 3 5];
 M=[8 12 20; 2 3 5; 4 6 10];

Solution Stats

75.91% Correct | 24.09% Incorrect
Last Solution submitted on Mar 08, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers792

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!
Go to top of page