MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   在Matlab中按列平均每N行 (https://www.labfans.com/bbs/showthread.php?t=22476)

poster 2019-12-06 22:00

在Matlab中按列平均每N行
 
我有四个240x30的矩阵。我需要计算每15行的平均值,并且需要按列进行计算。因此,最后我应该有30列的16个值。

因此,例如:
[INDENT] myMatrix = randi(240,30)

[/INDENT]这就是我到目前为止所拥有的:

averageBins = 15; meanByBinsMyMatrix = arrayfun(@(i) mean(myMatrix (i:i+averageBins-1)),1:averageBins:length(myMatrix )-averageBins+1)'; % the averaged vectormean() 这似乎在起作用,但我认为它仅在第一列中起作用。有谁知道如何为所有列做到这一点?

谢谢您的宝贵时间。

最好,Gluce



[url=https://stackoverflow.com/q/59214501]更多&回答...[/url]


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

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