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

34 visualizaciones (últimos 30 días)
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

Respuestas (1)

Sivsankar
Sivsankar el 6 de Nov. de 2024 a las 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

Categorías

Más información sobre Enterprise Deployment with MATLAB Production Server en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by