How to use IF with @(block_struct) function

6 ビュー (過去 30 日間)
Saud Alfalasi
Saud Alfalasi 2020 年 11 月 22 日
編集済み: Saud Alfalasi 2020 年 11 月 24 日
fun2 = @(block_struct) ...
if < 100
std2( * (;
Doesnt work.
I actually want to manipulate individual elements of my block
blocks made of 8x8 values ranging from 0-255
  2 件のコメント
Saud Alfalasi
Saud Alfalasi 2020 年 11 月 22 日
Hi Geoff
blockyImageR = blockproc(redChannel, blockSize, fun);
blockyImageG = blockproc(greenChannel, blockSize, fun);
blockyImageB = blockproc(blueChannel, blockSize, fun);
rgbImage2 = cat(3, blockyImageR, blockyImageG, blockyImageB);
I'm trying to create a method of LSB insertation based on a sequece to do with individual blocks.
Just as a test I'm trying to only change values of numbers in my block according to the values.
the data field is is part of the array with is a 9x9x1 block
I would also like to try and pinpoint the minddle value of my block (coordinates 2,2) and do a quoteince differnce betwen it and the surrounding values.
Ideally what I want to do is not only change values in blocks but also manage the sequence of movement from block to block - example follwing some kind of sequence which results in going from block1 > block 7 > block 27



Athul Prakash
Athul Prakash 2020 年 11 月 24 日
Hi Saud,
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 =;
% code for processing every other element
Hope it helps!
  3 件のコメント
Saud Alfalasi
Saud Alfalasi 2020 年 11 月 24 日
編集済み: Saud Alfalasi 2020 年 11 月 24 日
Blow away, you gave great help. Answer has been accepted. May I ask if you're contactable in any way? I could do with some guidance


その他の回答 (0 件)


Find more on Direct Interface Communication in Simulink in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by