Runnin a Matlab function in a new Matlab instance by using the system command

조회 수: 13 (최근 30일)
Within a running Matlab instance I need to run a function with arguments in a new Matlab instance. This is the code of the function (for simplicity this is a dummy test function replicating my needs):
function res = networkID(inp)
res = inp;
save('netID.mat','inp');
disp('processing done');
return
This is the code of the call:
x = 'HFR_WHub_TEST';
logFilename = 'Test.log';
system(['/usr/local/MATLAB/R2018a/bin/matlab -nosplash -nodesktop -r ''networkID(''' x '''); quit'' -logfile ' logFilename ' &'])
The log file reports this:
< M A T L A B (R) >
Copyright 1984-2018 The MathWorks, Inc.
R2018a (9.4.0.813654) 64-bit (glnxa64)
February 23, 2018
[Warning: Function count has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
{Undefined function or variable 'HFR_WHub_TEST'.
}
Can anybody tell me if it is possibile to let it work and how?
Thanks.

답변 (1개)

Jonas
Jonas 2022년 8월 11일
Hello Lorenzo, I am facing the same challenge. I want to call a function but it should run in a new matlab instance. Have you solved the problem? Greetings!

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by