but as far as I understand arrayfun is not vectorized, or is it?推荐答案 a.b返回多个输出,因此不能期望在其上调用函数.我不使用arrayfun可以想到的最好的单线是:a.b returns multiple outputs, so you can't expect to call a function on it. The best one-liner I can think of without using arrayfun is:y = subsref([a.b], substruct('.', c));请注意,a.b.c实际上与以下内容相同:Note that a.b.c is effectively the same as:y = subsref(a.b, substruct('.', c))这就是为什么它不适用于非标量a的原因.Which is why it shouldn't work for non-scalar a. 这篇关于在MATLAB中对结构进行多级索引的向量化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 22:30