Getting many outputs using blockproc

Youssra · Mar 4, 2022 · 2.3K views
Question
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.  
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Aug 23, 2026
No, this is not possible with blockproc().
 
You can use something like
 
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.

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!