MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   MATLAB:从结构数组中收集 (https://www.labfans.com/bbs/showthread.php?t=22728)

poster 2019-12-10 16:49

MATLAB:从结构数组中收集
 
例如>>w = whos;的输出>>w = whos;返回结构数组。我想构造一个数组,其元素是每个结构中特定字段名称的标量。

执行此操作的最明显方法不是返回我想要的数组,而是每个答案单独返回。

>> w(1:2).bytes ans = 64 ans = 128 我可以循环执行此操作,但想知道是否有更好的方法。


回答:
将方括号放在表达式周围,即

[w(1:2).bytes]

[url=https://stackoverflow.com/questions/1124765]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:29

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.