How do I call this function into my main code and assign an output to it ?

1 visualización (últimos 30 días)
Please can anyone clarify me on this. I have a function file named “decompose_kernel” and I have another .m file containing my codes with coefficients/outputs (CA, CH, CV, CD). These outputs are approximation and detail coefficients I extracted from my input image. I do wish to apply separable filter algorithm contained in the function file named “decompose_kernel” on these coefficients (CA,CH,CV,CD).
How do I call this function “decompose_kernel" into my main code and assign an output to it ?
I will appreciate your suggestions. Thanks

Respuesta aceptada

YT
YT el 18 de Oct. de 2018
If I got this correct, you got 2 files:
%mainfile.m
... some code and variables CA, CH, CV, CD
and
%decompose_kernel.m
function [outputarguments] = decompose_kernel(inputarguments)
... some code
end
If this is correct, I assume you never really worked with functions much before and should read up on how to use them ( https://mathworks.com/help/matlab/ref/function.html ).
So if you want to use the function decompose_kernel in your main file and use the variables CA/CH/CV/CD, you can do it like this:
%mainfile.m
... some code and variables CA, CH, CV, CD
[output] = decompose_kernel(CA, CH, CV, CD);

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by