Select first three elements of double inside cell array

3 次查看(过去 30 天)
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