how to generate matrix of size 10X10?
59 次查看(过去 30 天)
显示 更早的评论
I have generated the numbers from 1 to 10 by using the command 1:1:10. I got 1X10 size matrix but I want the matrix of size 10X10 i.e, each column values should be same. Please help me.
回答(2 个)
Andrei Bobrov
2014-3-26
one way
ones(10,1)*(1:10)
2 个评论
Ankita Kalra
2017-10-16
Dera Andrei, I need 1 to 10 values in a column of a 10x10 matrix (without the use of for loop).
Julie
2023-2-21
编辑:Julie
2023-2-21
there is a simple and easy way by typing magic(x) on the command window
x means how many rows and columns in a matrix do you want, for example, if you want to build a 10x10 matrix, you just need to type magic(10) on the command window, then you will get what you want.
1 个评论
Walter Roberson
2023-2-21
The user needed a specific matrix in which all of the columns were the same
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!