How do I create a (10,10) matrix containing numbers from 1 to 100?
174 次查看(过去 30 天)
显示 更早的评论
How do I create a (10,10) matrix containing numbers from 1 to 100?
I just want the numbers to go 1 to 10 on the top row, then 11-20 on the 2nd row etc.
2 个评论
采纳的回答
更多回答(4 个)
Steven Lord
2022-1-25
Another solution using implicit expansion (which wasn't available back in 2013 when this question was posted):
n = 10;
A = (1:n) + n*(0:n-1).'
0 个评论
SYED ABOU ILTAF HUSSAIN
2018-9-2
编辑:SYED ABOU ILTAF HUSSAIN
2018-9-2
Try this a= [1:10]; for i=2:10 a(i,:)=a(i-1,:)+10; end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!