Codegen Errors. How to do It

2 ビュー (過去 30 日間)
Aravin
Aravin 2017 年 8 月 12 日
回答済み: Walter Roberson 2017 年 8 月 12 日
I have one function which is quite slow in bigger Data, I m interested to convert into C (Mex). I tried one example.
my function in .m is
function mm=myMatching(F1,F2)
[numN, tf1] = size(F1); % total features in img1 and neighbors
tf2 = size(F2,2); % total features in img2
mm = zeros(tf2, tf1);
for i=1:tf1
for j=1:tf2
m = sum(ismember(F1(:,i), F2(:,j)));
mm(j,i) = m/numN;
end
end
When I execute following code
codegen myMatching.m -args {t1,t2}
where t1 and t2 are sample matrix
when I execute
t= myMatching_mex(t1, t2);
then it works fine. However, if the dimensions of t1, or t2 are changes then it gives error. How can I make it general.

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 8 月 12 日
You should be using coder.varsize()

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by