Compiled matlab function does not recognize 'hypercube' function from the 'Image Processing Toolbox Hyperspectral Imaging Library'
10 visualizaciones (últimos 30 días)
I have a very simple matlab function that calls the hypercube function (Image Processing Toolbox Hyperspectral Imaging Library) to load hyperspectral data. The codeline is like this: hypercube('path/to/hyperfile.img'). When I run the function in the matlab console, everything works perfectly fine. However, after compiling and executing the function I get the following error: Unrecognized function or variable 'hypercube'
I'm using MATLAB R2021 on a linux server. The command to compile the matlab function is:
/usr/local/MATLAB/R2021b/bin/mcc -o hyper_test -W main:hyper_test -T link:exe -d build/ -v hyper_test.m
I had a similar problem month ago: Compiled matlab function does not recognize 'predict' function from the statistics and machine learning toolbox - MATLAB Answers - MATLAB Central (mathworks.com). Thanks to Stevens answer I could resolve the problem. (Limitations - MATLAB & Simulink - MathWorks Deutschland)
I tried something similar to solve the current problem: introducing the hypercube.m when compiling my function
/usr/local/MATLAB/R2021b/bin/mcc -o hyper_test -W main:hyper_test -T link:exe -d build/ -v hyper_test.m a - hypercube.m
but it didn't help. Would be great if someone has an idea how to solve this.
Vinayak Choyyan el 3 de Ag. de 2023
'hypercube' function is a part of Image Processing Toolbox Hyperspectral Imaging Library which is a support package. To include support packages, try using the -Z option of mcc. You may try adding
to your compilation code. Please refer to https://in.mathworks.com/help/compiler/mcc.html?s_tid=doc_ta#mw_e47936cc-924b-41b1-94cd-c1b4be325db4 for more details.
Also, I notice in the question above, you have written "-v hyper_test.m a - hypercube.m". I believe you where trying to do "-a" and not "a -".
Hope this resolves the issue you are facing.