I want to apply SVD for each 4*4 blocks using the "blockproc" and get 3 outputs: U, S and V so I can reconstract all blocks together again but Matlab gets me "too many ouput arguments". How can I solve this problem? fun = @(block_struct) svd(block_struct.data); [U S V] = blockproc(a, [4 4], fun) This is the error that I have: Error using blockproc Too many output arguments.
John Williams answered .
2025-11-20
function r = blocksvd(block_struct) [U, S, V] = svd(block_struct.data); Spad = nan(size(U)); Vpad = Spad; Spad(1:size(S,1),1:size(S,2)) = S; Vpad(1:size(U,1),1:size(U,2)) = U; r = [U; Spad; Vpad]; end
this returns a 12 x 4 array that can be broken up again into U, S, V.