On Cell Array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
need help with the following question.
Write an expression that would display a random element from a cell array (without assuming that the number of elements in the cell array is known).
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 10 Feb. 2012
C - your cell array n - number of elements in the your cell array
out = C(randi(n))
or
out = C{randperm(n,1)}
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Types finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!