MATLAB: Retrieve Spesific Row of Cell Matrix

cellcell arraycell arraysMATLABmatrix

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'

Best Answer

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)),:);