|
"St.Ivanov" wrote in message <jr2fjn$374$1@newscl01ah.mathworks.com>...
>
> I read that mat2cell can divide an image in this way:
> C=mat2cell(I,[32],[32]) but C is a 8x8 cell array with each cell storing a 32x32 submatrix of I.
==============
No, mat2cell can't do this. Not with the convenient syntax you've shown as the following demonstration shows:
>> I=rand(8*32);
>>
>> C=mat2cell(I,[32],[32]);
Error using mat2cell (line 107)
Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [256 256].'
However, mat2tiles will let you do something very similar:
http://www.mathworks.com/matlabcentral/fileexchange/35085-split-nd-array-into-equal-sized-cells
>How can I assign a name to each of the blocks using this sintax and how would this look like a loop.
=======
You wouldn't assign a name to each cell separately (that would be poor and awkward practice). You index them, as in the following
for i=1:numel(C)
C{i}=myfunc(C{i})
end
Or equivalently, you use cellfun
C=cellfun(@myfunc,C,'uniformoutput',0);
|