Matlab coder cannot find knnSearch function

12 ビュー (過去 30 日間)
Michael Sorocky
Michael Sorocky 2023 年 6 月 28 日
回答済み: Udit06 2024 年 11 月 11 日 8:15
Hello,
I am trying to convert a Matlab function to C code. Part of this function uses the built-in pcregisterloam() function; it runs successfully in Matlab. However, when I try to compile it, I recieve an error related to the pcregisterloam() function stating:
"Undefined function or variable 'knnSearch'. " (see attached for a screenshot).
If I open the function knnSearch, I'm directed to the file knnsearch.m (note the lowercase "s"), so I assume the link to the proper function is broken somehow.
At the matlab terminal, running
help knnSearch
gives:
--- knnSearch not found. Showing help for knnsearch instead. --
However, running
which knnSearch
yields:
knnSearch is a built-in method % vision.internal.Kdtree method
How can I direct the coder to the proper function? Thanks in advance!

回答 (1 件)

Udit06
Udit06 2024 年 11 月 11 日 8:15
Hi Michael,
I was facing a similar issue in MATLAB R2023a. However, I was able to generate the C code in MATLAB R2024a. So, you can consider updating to a latest version of MATLAB to resolve the issue.
Running "which" command with an inbuild function appears to be case insensitive. I tried running the following command to verify that the results corresponds to case insensitive search:
which PLOT
/MATLAB/toolbox/matlab/bigdata/@tall/plot.m % tall method
So, in your case, there is no method with the name "knnSearch". The correct method name is "knnsearch".
I hope this helps.

カテゴリ

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