From: Masha on
Hello,

I am currently working on matlab 2009b ver.
I have the folowing part that works:

fun = @(x) sum(x(:));
temp_im = blkproc(1.-im_binary,win_size,fun);

im_binary is <2183x1375 logical>, win_size is [400 400];

Since I understand that in new version blkproc is removed, I tried to change blkproc function to blockproc (so I'll be able to run the code in the future versions).

after update:
fun = @(x) sum(x(:));
temp_im = blockproc(1.-im_binary,win_size,fun);

But the change didn't work and I got the following error:

??? Error using ==> blockproc>userfunDispatcher at 719
There was an error when evaluating the user supplied function FUN.
The error message was:

Undefined function or method 'sum' for input arguments of type
'struct'.

Error in ==> blockproc at 214
output_block = userfunDispatcher(fun,input_struct,trim_border);

Does anyone knows what can be the problem? Nothing has changed except the name of the function.

Thanks,
Masha
From: Masha on
"Masha " <maria.zeldin(a)gmail.com> wrote in message <hqp1ch$bjd$1(a)fred.mathworks.com>...
> Hello,
>
> I am currently working on matlab 2009b ver.
> I have the folowing part that works:
>
> fun = @(x) sum(x(:));
> temp_im = blkproc(1.-im_binary,win_size,fun);
>
> im_binary is <2183x1375 logical>, win_size is [400 400];
>
> Since I understand that in new version blkproc is removed, I tried to change blkproc function to blockproc (so I'll be able to run the code in the future versions).
>
> after update:
> fun = @(x) sum(x(:));
> temp_im = blockproc(1.-im_binary,win_size,fun);
>
> But the change didn't work and I got the following error:
>
> ??? Error using ==> blockproc>userfunDispatcher at 719
> There was an error when evaluating the user supplied function FUN.
> The error message was:
>
> Undefined function or method 'sum' for input arguments of type
> 'struct'.
>
> Error in ==> blockproc at 214
> output_block = userfunDispatcher(fun,input_struct,trim_border);
>
> Does anyone knows what can be the problem? Nothing has changed except the name of the function.
>
> Thanks,
> Masha
--------------------------------
The problem is solved. blockproc expect x to be struct so the change needed is:
fun = @(x) sum(x.cdata(:));

Masha