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)
% GTPYTHONCOMMAND Call python witht the proper command
function [status, msg, ver] = gtPythonCommand(args, use_fable, use_exec)
% GTPYTHONCOMMAND Calls python with the proper command
%
% [status, msg, ver] = gtPythonCommand(args[, use_fable])
% ------------------------------------------------------------------------
% [status, msg, ver] = gtPythonCommand(args, [use_fable], [use_exec])
% -------------------------------------------------------------------
% INPUT:
% args = <string> Argumants passed to the python invocation
%
% OPTIONAL INPUT:
% use_fable = <logical> Source fable configuration file before {false}
% args = <string> Arguments passed to the python invocation
% use_fable = <logical> Source fable configuration file before {false}
% use_exec = <logical> Use the python command before the script {true}
%
% OUTPUT:
% status = <int> System command return code
% msg = <string> Python command output
% status = <int> System command return code
% msg = <string> Python command output
% ver = <int> Version of python
%
% OPTIONAL OUTPUT:
% ver = <int> Version of python
% Version 002 08-11-2013 by LNervo
% Added option to use or not the python executable
%
% Version 001 08-02-2013 by YGuilhem
% Default paramater value
if ~exist('use_fable', 'var') || isempty(use_fable)
use_fable = false;
end
if ~exist('use_exec', 'var') || isempty(use_exec)
use_exec = true;
end
pythonExes = {'python', 'python26'};
% Loop over each python executables
......@@ -51,6 +56,9 @@ if use_fable
end
% Run command
if ~use_exec
pythonExe = '';
end
[status, msg] = system([fableSet pythonExe ' ' args]);
% 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