Select first three elements of double inside cell array

1 回表示 (過去 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 Center および File ExchangeData Types についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by