How do I create a Matlab 5x5 matrix of numbers 1-100?

7 次查看(过去 30 天)
I have to make an script that creates a 5x5 matrix of 1-100 numbers in increasing order.

采纳的回答

Adam Danz
Adam Danz 2021-2-15
编辑:Adam Danz 2021-2-16
Use X=randi(100,1,5*5) to get random integers <=100 or x=rand(1,5*5)*100 if you want floating decimals.
Then use sort() to achieve increasing order.
Then reshape the vector back into a 5x5 matrix using reshape().

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by