Borrar filtros
Borrar filtros

finding cell array elements

1 visualización (últimos 30 días)
Tha saliem
Tha saliem el 11 de Abr. de 2017
Comentada: Tha saliem el 11 de Abr. de 2017
hi. I have a cell array containing many values like this:
x{2x1 cell;3x1 cell}
and each cell contains value like this:
x{1,1}={4;4}
x{2,1}={4;[1;4];[1;3]}
y=[0,0,1,-1,0,0; 1,0,-1,1,0,0] %2D array
I want to search elements of x one by one in corresponding row of y.
Thanks in advance

Respuesta aceptada

Guillaume
Guillaume el 11 de Abr. de 2017
This would do it:
result = arrayfun(@(row) cellfun(@(columns) y(row, columns), x{row}, 'UniformOutput', false), ...
(1:size(x, 1)).', 'UniformOutput', false);
  1 comentario
Tha saliem
Tha saliem el 11 de Abr. de 2017
Thanks alot. this is so accurate

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by