Azzera filtri
Azzera filtri

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

6 visualizzazioni (ultimi 30 giorni)
I have to make an script that creates a 5x5 matrix of 1-100 numbers in increasing order.

Risposta accettata

Adam Danz
Adam Danz il 15 Feb 2021
Modificato: Adam Danz il 16 Feb 2021
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().

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by