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

8 ビュー (過去 30 日間)
Biyan
Biyan 2024 年 10 月 17 日
回答済み: Sivsankar 2024 年 11 月 6 日
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 日
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 Center および File ExchangeInstallation についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by