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

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.

Antworten (1)

Jonas
Jonas am 11 Aug. 2022
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!

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Beantwortet:

am 11 Aug. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by