Problem 42691. Matrix of almost all zeros, except for main diagonal
Write a program to input an integer n and build a n-by-n matrix with the numbers 1,2,...,n on the main diagonal and zeros elsewhere.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers185
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
3031 Solvers
-
All your base are belong to us
559 Solvers
-
07 - Common functions and indexing 6
458 Solvers
-
1452 Solvers
-
Back to Basics - Find no. of elements in a matrix?
317 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!