How to get a matrix random to use from a function?

1 Ansicht (letzte 30 Tage)
Kalpha.mc
Kalpha.mc am 12 Sep. 2020
Beantwortet: Walter Roberson am 12 Sep. 2020
I used perms(1:3)
how would i get one matrix of random such as [1,3,2] so i can use it?
example-
I have three eggs and i numbered them 1, 2, and 3 then placed them in a hat. I would then draw each one out and place them under one of the three labels Breakfast, Lunch, Dinner.
so if i get a matrix of [1,3,2]
Break Lunch Dinner
1 3 2

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Sep. 2020
mealcats = categorical({'Breakfast', 'Lunch', 'Dinner'});
mealcats(randperm(3))

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by