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

1 回表示 (過去 30 日間)
Chidiebere Ike
Chidiebere Ike 2018 年 10 月 18 日
コメント済み: Chidiebere Ike 2018 年 10 月 18 日
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);
  1 件のコメント
Chidiebere Ike
Chidiebere Ike 2018 年 10 月 18 日
Thanks so much for your assistance. It's solved now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by