On Cell Array

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).

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 10 de Feb. de 2012

0 votos

C - your cell array n - number of elements in the your cell array
out = C(randi(n))
or
out = C{randperm(n,1)}

Más respuestas (0)

Categorías

Más información sobre Data Types en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 10 de Feb. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by