2D non-Square Matrix to 2D square matrix

How to make a matrix A with diamension m x n , m,n>1 to a square matrix ?

 Accepted Answer

madhan ravi
madhan ravi on 27 Apr 2019
Edited: madhan ravi on 27 Apr 2019
Wanted = nan(length(A));
Wanted(1:numel(A)) = A

3 Comments

In case if we want to insert zero in place of NaN then ??
instead of nan() use zeros()

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!