On Cell Array

조회 수: 1 (최근 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 CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by