Retrieve Spesific Row of Cell Matrix

3 ビュー (過去 30 日間)
Angga Lisdiyanto
Angga Lisdiyanto 2016 年 6 月 30 日
コメント済み: Angga Lisdiyanto 2016 年 6 月 30 日
Hi, i want to retrieve spesific row data of cell matrix or with a random method. In example :
cell_matrix = {
'i', 'hate', 'war';
'i', 'likes', 'peace';
'i', 'love', 'cats';
}
Then i want below result :
first_row =
'i' 'hate' 'war'
random_row =
'i' 'likes' 'peace'

採用された回答

Andrei Bobrov
Andrei Bobrov 2016 年 6 月 30 日
first_row = cell_matrix(1,:);
random_row = cell_matrix(randperm(size(cell_matrix,1),1),:);
or
random_row = cell_matrix(randi(size(cell_matrix,1)),:);
  1 件のコメント
Angga Lisdiyanto
Angga Lisdiyanto 2016 年 6 月 30 日
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by