How to use IF with @(block_struct) function
조회 수: 24(최근 30일)
fun2 = @(block_struct) ...
if block_struct.data < 100
std2(block_struct.data) * (block_struct.data));
I actually want to manipulate individual elements of my block
blocks made of 8x8 values ranging from 0-255
Athul Prakash 2020년 11월 24일
Since blockproc uses anonymous functions, you may save your multi-line function into a script, say myFunc.m and then pass @myFunc to your blockproc call.
You can find block_struct structure described in the following doc (under More About section): 'blockproc' Documentation.
You may work out a way to manage the sequence artificially using some of those fields. For example, using block_struct.location to skip processing the 2nd block:
function out = myFunc(block_struct) % size would be 100x100
% skipping the 2nd block.
out = block_struct.data;
% code for processing every other element
Hope it helps!