Select first three elements of double inside cell array

19 Ansichten (letzte 30 Tage)
Samar Adhikari
Samar Adhikari am 25 Mär. 2025
Kommentiert: Samar Adhikari am 25 Mär. 2025
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]}

Akzeptierte Antwort

Stephen23
Stephen23 am 25 Mär. 2025
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]}

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by