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

조회 수: 1 (최근 30일)
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

채택된 답변

YT
YT 2018년 10월 18일
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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by