Skip to content
Snippets Groups Projects
Commit 1fff0384 authored by Laura Nervo's avatar Laura Nervo
Browse files

gtPythonCommand : now it's possible to run python scripts from matlab without...

gtPythonCommand : now it's possible to run python scripts from matlab without the need of using the executable. Added the flag 'use_exec' for that purpose.

Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent c222bd1a
No related branches found
No related tags found
No related merge requests found
function [status, msg, ver] = gtPythonCommand(args, use_fable) function [status, msg, ver] = gtPythonCommand(args, use_fable, use_exec)
% GTPYTHONCOMMAND Call python witht the proper command % GTPYTHONCOMMAND Calls python with the proper command
% %
% [status, msg, ver] = gtPythonCommand(args[, use_fable]) % [status, msg, ver] = gtPythonCommand(args, [use_fable], [use_exec])
% ------------------------------------------------------------------------ % -------------------------------------------------------------------
% INPUT: % INPUT:
% args = <string> Argumants passed to the python invocation % args = <string> Arguments passed to the python invocation
% % use_fable = <logical> Source fable configuration file before {false}
% OPTIONAL INPUT: % use_exec = <logical> Use the python command before the script {true}
% use_fable = <logical> Source fable configuration file before {false}
% %
% OUTPUT: % OUTPUT:
% status = <int> System command return code % status = <int> System command return code
% msg = <string> Python command output % msg = <string> Python command output
% ver = <int> Version of python
% %
% OPTIONAL OUTPUT: % Version 002 08-11-2013 by LNervo
% ver = <int> Version of python % Added option to use or not the python executable
% %
% Version 001 08-02-2013 by YGuilhem % Version 001 08-02-2013 by YGuilhem
% Default paramater value % Default paramater value
if ~exist('use_fable', 'var') || isempty(use_fable) if ~exist('use_fable', 'var') || isempty(use_fable)
use_fable = false; use_fable = false;
end end
if ~exist('use_exec', 'var') || isempty(use_exec)
use_exec = true;
end
pythonExes = {'python', 'python26'}; pythonExes = {'python', 'python26'};
% Loop over each python executables % Loop over each python executables
...@@ -51,6 +56,9 @@ if use_fable ...@@ -51,6 +56,9 @@ if use_fable
end end
% Run command % Run command
if ~use_exec
pythonExe = '';
end
[status, msg] = system([fableSet pythonExe ' ' args]); [status, msg] = system([fableSet pythonExe ' ' args]);
% Add version output if asked % Add version output if asked
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment