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

15 次查看(过去 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