Berk Demir
Berk Demir

Reputation: 11

Creating random alingment for a matrix in matlab

How can I create an array with number from 1 to 10 for example without repeating. Because I will use it to re-aling a matrix's rows. For example of 1 to 10, I want my output as: 4 1 3 8 2 5 6 7 9 10 But I don't want to have repated numbers. How can I do that?

Upvotes: 0

Views: 49

Answers (2)

arduinolover
arduinolover

Reputation: 176

You can also use A = magic(4); B = A(A<=10); B will give you required matrix.

Upvotes: 0

user1132648
user1132648

Reputation:

I think what you need is -

randperm(10)

Upvotes: 3

Related Questions