user1673206
user1673206

Reputation: 1711

send variable to function / global variable

I have the variable delta in the main and the line: Y_Q = blkproc(Y_dct, [8 8], @Quantization);

I need the function Quantization to know about the variable delta.

Can someone please help me? thanks..

Upvotes: 1

Views: 81

Answers (1)

Ben Voigt
Ben Voigt

Reputation: 283803

If Quantization is a subfunction, it will be able to access variables in the outer function (you can also introduce a subfunction that calls Quantization with the callback arguments and any additional values you need).

Another method is to make your shared variable global, using the global statement at the top of each function that should share it.

Upvotes: 2

Related Questions