top of page

Generate random matrix of desired number of columns and rows (MATLAB)

Updated: Apr 25, 2021

1. Open your command window

2. Say, you want to create a random matrix of 4 rows and 5 columns with the matrix name as "x". Type, x = rand(4,5)

3. Hit enter and you'll find your matrix is output. Each time you write the same command you will get a matrix containing different elements

4. Type "clc" to clear out your command window

15 views0 comments

Recent Posts

See All


bottom of page