Select first three elements of double inside cell array

Given Cell array:
3x1 cell array
{[56 54 36 35]}
{[58 56 55 36]}
{[89 60 56 45]}
Output :
3x1 cell array
{[56 54 36]}
{[58 56 55]}
{[89 60 56]}

 Respuesta aceptada

C = {[56,54,36,35];[58,56,55,36];[89,60,56,45]}
C = 3x1 cell array
{[56 54 36 35]} {[58 56 55 36]} {[89 60 56 45]}
D = cellfun(@(v)v(1:3),C,'uni',0)
D = 3x1 cell array
{[56 54 36]} {[58 56 55]} {[89 60 56]}

Más respuestas (0)

Categorías

Más información sobre Data Types en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 25 de Mzo. de 2025

Comentada:

el 25 de Mzo. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by