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

6 vues (au cours des 30 derniers jours)
Lorenzo Paolo Corgnati
Lorenzo Paolo Corgnati le 24 Fév 2020
Réponse apportée : Jonas le 11 Août 2022
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.

Réponses (1)

Jonas
Jonas le 11 Août 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!

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by