Borrar filtros
Borrar filtros

Retrieve Spesific Row of Cell Matrix

1 visualización (últimos 30 días)
Angga Lisdiyanto
Angga Lisdiyanto el 30 de Jun. de 2016
Comentada: Angga Lisdiyanto el 30 de Jun. de 2016
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'

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 30 de Jun. de 2016
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)),:);

Más respuestas (0)

Categorías

Más información sobre Desktop en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by