Ignore:
Timestamp:
Mar 23, 2026, 4:49:29 PM (3 hours ago)
Author:
sommeria
Message:

various improvements...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/command_launch_matlab.m

    r1184 r1201  
    1 %'command_launch_matlab': creates the command strings for opening a new Matlab session 
     1%'command_launch_matlab': creates the command strings for opening a new Matlab session
    22% and running a programme in a Linux system('GLNX86','GLNXA64','MACI64')
    33%------------------------------------------------------------------------
     
    66%OUTPUT
    77% cmd=set of system commands (char string) to write in an executable file: [fid,message]=fopen(file_exe,'w');
    8                            % fprintf(fid,cmd); % fill the executable file with the  char string cmd
    9                            % fclose(fid); % close the executable file
    10                            %  system(['chmod +x ' file_exe]); % set the file to executable
    11                            % system([file_exe ' &'])%  execute the command file
    12                            
     8% fprintf(fid,cmd); % fill the executable file with the  char string cmd
     9% fclose(fid); % close the executable file
     10%  system(['chmod +x ' file_exe]); % set the file to executable
     11% system([file_exe ' &'])%  execute the command file
     12
    1313%
    1414%INPUT:
     
    2828matlab_ver = ver('MATLAB');
    2929matlab_version = matlab_ver.Version;
     30% matlab launch options:
     31  % -nodisplay: no graphic display
     32  % -nodesktop: disables the desktop environment.
     33   % replaces -nojvm: no Java-related overhead (useful for scripts or batch jobs)
     34   % TODO : replace all these options by -batch for newer Matlab versions
    3035cmd=[...
    3136    '#!/bin/bash\n'...
     
    3439    'module load matlab/' matlab_version '\n'...% CHOICE OF THE SAME MATLAB VERSION AS THE CURRENT MATLAB SESSION (not mandatory)
    3540    'time_start=$(date +%%s)\n'...
    36     'matlab -nodisplay -nosplash -nojvm ''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session  without display
     41    'matlab -nodisplay -nosplash -nodesktop ''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session  without display
    3742    'addpath(''' path_uvmat ''');\n'...
    3843    'current_dir=pwd;\n'... % current working dir
    3944    'cd(''' ActionPath ''');\n'...
    40 'h_fun=str2func(''' ActionName ''');\n'...% create the function handle for the function ActionName
    41 'cd(current_dir);\n'];
    42  %   'addpath(''' ActionPath ''');\n'];
     45    'h_fun=str2func(''' ActionName ''');\n'...% create the function handle for the function ActionName
     46    'cd(current_dir);\n'];
    4347for iprocess=1:numel(inputxml)
    44 %    cmd=[cmd '' ActionName  '(''' inputxml{iprocess} ''');\n'];
    45 cmd=[cmd ' h_fun  (''' inputxml{iprocess} ''');\n'];
     48    cmd=[cmd ' h_fun  (''' inputxml{iprocess} ''');\n'];
    4649end
    4750cmd=[cmd  'exit\n' 'END_MATLAB\n'];
    48     if strcmp(option,'background')
     51if strcmp(option,'background')
    4952    cmd=[cmd ...
    50     'time_end=$(date +%%s)\n'...
    51     'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n'];
    52     end
     53        'time_end=$(date +%%s)\n'...
     54        'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n'];
     55end
    5356
    5457
Note: See TracChangeset for help on using the changeset viewer.