On Cell Array

5 ビュー (過去 30 日間)
newiuht
newiuht 2012 年 2 月 10 日
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).

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 2 月 10 日
C - your cell array n - number of elements in the your cell array
out = C(randi(n))
or
out = C{randperm(n,1)}

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by