Select first three elements of double inside cell array

조회 수: 3 (최근 30일)
Samar Adhikari
Samar Adhikari 2025년 3월 25일
댓글: Samar Adhikari 2025년 3월 25일
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]}

채택된 답변

Stephen23
Stephen23 2025년 3월 25일
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]}

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by