i have 4x3500 cell array. first row single number, 2 row single string, 3rd , 4th rows single numbers.
ex:
1 1 2 3 3 4 5 5 5 6 hi no ya ........ % idea 28 34 18 0 3 ...... 55 2 4 42 24 .....
i able select columns have value in first row. ie if wanted '1' first row value, return
1 1 hi no 28 34 55 2
then sort based on 2nd row's string. ie if wanted have'hi', return:
1 hi 28 55
i have attempted do:
variable = cellarray{:,find(cellarray{1,:} == 1)}
however keep getting:
error using find many input arguments.
or
error using == many input arguments.
any appreciated! :)
{}
indexing return comma separated list provide multiple outputs. when pass find
, it's same passing each element of cell array separate input. leads error many input arguments.
you want surround comma-separated list []
create array or numbers. also, don't need find
because can use logical indexing grab columns want. additionally, want index using ()
grab relevant rows, again avoid comma-separated list.
variable = cellarray(:, [cellarray{1,:}] == 1)
Comments
Post a Comment