【发布时间】:2015-08-22 01:49:23
【问题描述】:
如何从对象数组中提取对象属性数组(该数组中的每个对象都具有该属性?)
例如:
classdef myClass
properties
myProperty = 1
end
end
--
myObjectMatrix(1:1000) = myClass()
myObjectMatrix(100:234).myProperty % what I thought would work but results in lots of individual results
[myObjectMatrix(100:234)..myProperty] 有效,但仅限于一维。如果我有多个维度来“折叠”我的结果,我需要使用 reshape()。
有没有更好的办法?
谢谢!
【问题讨论】: