how to use randomMatrix properly

2 views (last 30 days)
I am trying to us the randomMatrix function using the example in the documentation.
when i write :
linalg::randomMatrix(2, 2, Dom::Integer)
I get: Error: Unexpected MATLAB operator.

Accepted Answer

Sean de Wolski
Sean de Wolski on 14 Nov 2013
This is a MuPad command. To run it, open a MuPad note book and run it there:
mupad %or click the app.
And for more info:
doc mupad
If you just want a random integer matrix in MATLAB look at randi
randi(10,2,2)
And for more info:
doc randi
  2 Comments
Assaf
Assaf on 14 Nov 2013
Thanks, and if I want an m by n matrix with each row having the numbers 1 to n in a random order?
Sean de Wolski
Sean de Wolski on 14 Nov 2013
You could use randperm in a loop or:
m = 5;
n = 9;
[~,R] = sort(rand(m,n),2)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!