Problem with compiled script [MWMCR::EvaluateFunction error]
6 ビュー (過去 30 日間)
古いコメントを表示
I have a script which works 100% from within MATLAB, but as soon as it is run after being compiled, it does not work and I get the following error message:
.. MWMCR::EvaluateFunction error ...
Unable to resolve the name coder.internal.constNonSingletonDim.
... Matlab M-code Stack Trace ...
at
file C:\Program Files\MATLAB\R2019b\mcr\toolbox\signal\signal\goertzel.m, name goertzel, line 54.
I tried the following, but all fails with the same error:
- Compile it as a .net library and run from within a c# application.
- Compile it as a standalone application loading and saving a .mat file to interface with c#.
I believe that the problem lies somewhere within the MATLAB runtime, but I do not have the experience to know where to start to debug this.
I will unfortunately not be able to share the source code.
1 件のコメント
CG
2019 年 12 月 17 日
I have the same problem. Whenever I compile a script that uses the goertzel command, I get the error:
"Unable to resolve the name coder.internal.constNonSingletonDim."
It seems to be a general problem.
回答 (1 件)
Tuba Abbasi
2020 年 2 月 19 日
編集済み: Steven Lord
2020 年 3 月 5 日
The root cause of this issue is a set of helper functions which are linked to the "goertzel()" function - coder. Internal.constNonSingletonDim and coder.internal.assertValidDim. These functions were part of a component in R2019b which was not deployable. Our development team is aware of this issue and is working on a fix. In the meantime, please try the following workaround:
1. Launch MATLAB with administrative rights and run the script below first.
destinationFolder=fullfile(matlabroot ,'toolbox','compiler','patch','+coder','+internal');
mkdir(destinationFolder);
source1=which('coder.internal.assertValidDim');
source2=which('coder.internal.constNonSingletonDim');
copyfile(source1, fullfile(destinationFolder, 'assertValidDim.m'),'f');
copyfile(source2, fullfile(destinationFolder, 'constNonSingletonDim.m'),'f');
2. Restart MATLAB with administrative rights. This would ensure that if there are any classes loaded in memory, those are cleared off.
3. Add the %#function pragmas below to help the MATLAB Compiler locate these functions:
%% pragma to help Compiler locate functions
%#function coder.internal.constNonSingletonDim
%#function coder.internal.assertValidDim
%%
For instance, in order to compile the Telephone Keypad Frequencies example in our documentation in MATLAB R2019b, you should add the following lines in the code prior to compiling:
%% pragma to help Compiler locate functions
%#function coder.internal.constNonSingletonDim
%#function coder.internal.assertValidDim
%%
Fs = 8000;
N = 205;
lo = sin(2*pi*697*(0:N-1)/Fs);
hi = sin(2*pi*1209*(0:N-1)/Fs);
data = lo + hi;
f = [697 770 852 941 1209 1336 1477];
freq_indices = round(f/Fs*N) + 1;
dft_data = goertzel(data,freq_indices);
stem(f,abs(dft_data))
ax = gca;
ax.XTick = f;
xlabel('Frequency (Hz)')
title('DFT Magnitude')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Java Package Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!