script returns success in MATLAB, Production Server Compiler App Test Client, but return failed using deployed archive in MPS

37 次查看(过去 30 天)
function [ret_createCTFFunction] = createCTFFunctionByCommand(mFile)
% % to create a ctf service that takes a mfile and convert to a ctf
% if exist(mFile, 'file') ~= 2
if ~exist('mFile', 'var') || isempty('mFile')
mFile = '.\data\mymagic.m';
end
if ~exist(mFile, 'file')
fprintf('Source %s does not exist\n', mFile);
ret_createCTFFunction = 'Source '+mFile+'does not exist\n';
return;
end
% jsonFilePath = '.\createCTFFunctionFunctionSignatures.json';
% mFilePath = '.\data\mymagic.m';
% Get the file name without suffix
[~, mfName, ~] = fileparts(mFile);
outputDir = ".\" + mfName;
ctfArchiveName = mfName;
% Construct the command string using the variables
% command = sprintf('mcc -W ''CTF:TestCTF,DISCOVERY:%s'' -U -d %s -v %s', jsonFilePath, outputDir, mFilePath);
command = sprintf('mcc -W ''CTF:%s'' -U -d %s -v %s', ctfArchiveName, outputDir, mFile);
% Execute the command
status = system(command);
% Check if the command was executed successfully
if status == 0
disp('Command executed successfully.');
ret_createCTFFunction = 'success';
else
disp('Error executing command.');
ret_createCTFFunction = 'Failed';
end
end

回答(1 个)

Sivsankar
Sivsankar 2024-11-6,5:59
I believe that you cannot have 'mcc' function calls within the function that needs to be compiled in the deployed archive. I don't think that the deployed archive can execute 'mcc' commands in the MATLAB Production Server. Your problem is similar to your following MATLAB answer, and you can refer this:
So, this may be the reason why your script is failing using the deployed archive. You could review the error log on the server for specific error messages that gives more insight.
Hope this helps!
Thanks

类别

Help CenterFile Exchange 中查找有关 Enterprise Deployment with MATLAB Production Server 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by