The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Using loop to Cube data
Replies: 7   Last Post: Sep 18, 2013 10:20 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: Using loop to Cube data
Posted: Sep 16, 2013 11:25 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Matthew Balint" <> wrote in message
> dpb <> wrote in message <l0vs32$ft4$>...
>> On 9/13/2013 3:03 PM, Matthew Balint wrote:


> I tried to use the blockprock function, and I don't understand the 'fun'
> function handle.

It is the function that you want to be applied to each block.

> It instructed me to use 'block_struct' and '' and I have
> no idea what those are or how to use them.

See the Definitions section of the BLOCKPROC documentation page for
information about the fields contained in the block_struct struct array.

My guess is that BLOCKPROC passes that structure instead of just the
specified piece of your matrix into the function because for image
processing applications that extra information may be useful. The data field
of that struct array contains just the specified piece of your matrix.

> My array is simply numeric and I thought was an array
> that contained multiple values, not just numeric values?

Take a look at this example:

>> M = reshape(1:16, [4 4]);
>> blockproc(M, [2 2], @(block_struct) mean(

BLOCKPROC will call this function four times: once with the upper left
2-by-2 block of M stored in, once with the upper-right,
once with the lower-left, and once with the lower-right.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.