A is a matrix of size 32*32.I want to subtract elements of each 4*4 block of A from their respective 4*4 means
1 次查看(过去 30 天)
显示 更早的评论
A is a matrix of size 32*32. out = blockproc(A,[4 4],@(x)mean(x.data(:)));
Using the above code, I am able to reduce A to 8*8 which is obtained by averaging each 4*4 blocks of A. Now, I want to subtract elements of each 4*4 block of A from their respective 4*4 means. Thanks !
0 个评论
采纳的回答
更多回答(1 个)
Fangjun Jiang
2020-2-12
编辑:Fangjun Jiang
2020-2-12
A=rand(32);
out = blockproc(A,[4 4],@(x)mean(x.data(:)));
temp=repmat({ones(4,1)},8,1);
temp=blkdiag(temp{:});
Result=A-temp*out*temp'
%% or run below to see the effect
temp*magic(8)*temp'
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!