Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab mcc编译的独立可执行文件:无法识别的函数或变量_Matlab_Mcc - Fatal编程技术网

matlab mcc编译的独立可执行文件:无法识别的函数或变量

matlab mcc编译的独立可执行文件:无法识别的函数或变量,matlab,mcc,Matlab,Mcc,我有以下文件helloworld.m: % helloworld.m function helloworld fprintf('\n=============') fprintf('\nHello, World!\n') fprintf('=============\n') end matlab运行时在我的路径中: echo $LD_LIBRARY_PATH :/usr/local/MATLAB/MATLAB_Runtime/v98/bin/glnxa64/ 我运行编

我有以下文件helloworld.m:

% helloworld.m
function helloworld
    fprintf('\n=============')
    fprintf('\nHello, World!\n')
    fprintf('=============\n')
end
matlab运行时在我的路径中:

echo $LD_LIBRARY_PATH
:/usr/local/MATLAB/MATLAB_Runtime/v98/bin/glnxa64/
我运行编译器,它完成时没有错误

注意:我的启动文件中的所有内容都包装在~isdeployed条件中:

Parsing file "helloworld.m" (referenced from command line).
Generating file "readme.txt".
Generating file "run_helloworld.sh".

ls
helloworld  helloworld.m  mccExcludedFiles.log  readme.txt  requiredMCRProducts.txt  run_helloworld.sh
现在,我尝试运行它,但它出现了一个神秘的错误消息:

./helloworld
Unrecognized function or variable 'helloworld'.

MATLAB:UndefinedFunction
Error: Unrecognized function or variable 'helloworld'.

看起来我需要添加正在编译的.m文件的父目录,如果不是在pwd中的话。这项工作:

 mcc -m ./helloworld.m
现在运行:

./helloworld 
=============
Hello, World!
=============