Changeset 1201 for trunk/src/command_launch_matlab.m
- Timestamp:
- Mar 23, 2026, 4:49:29 PM (3 hours ago)
- File:
-
- 1 edited
-
trunk/src/command_launch_matlab.m (modified) (4 diffs)
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 2 2 % and running a programme in a Linux system('GLNX86','GLNXA64','MACI64') 3 3 %------------------------------------------------------------------------ … … 6 6 %OUTPUT 7 7 % 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 cmd9 % fclose(fid); % close the executable file10 % system(['chmod +x ' file_exe]); % set the file to executable11 % system([file_exe ' &'])% execute the command file12 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 13 13 % 14 14 %INPUT: … … 28 28 matlab_ver = ver('MATLAB'); 29 29 matlab_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 30 35 cmd=[... 31 36 '#!/bin/bash\n'... … … 34 39 'module load matlab/' matlab_version '\n'...% CHOICE OF THE SAME MATLAB VERSION AS THE CURRENT MATLAB SESSION (not mandatory) 35 40 'time_start=$(date +%%s)\n'... 36 'matlab -nodisplay -nosplash -no jvm''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session without display41 'matlab -nodisplay -nosplash -nodesktop ''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session without display 37 42 'addpath(''' path_uvmat ''');\n'... 38 43 'current_dir=pwd;\n'... % current working dir 39 44 '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']; 43 47 for 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']; 46 49 end 47 50 cmd=[cmd 'exit\n' 'END_MATLAB\n']; 48 if strcmp(option,'background')51 if strcmp(option,'background') 49 52 cmd=[cmd ... 50 'time_end=$(date +%%s)\n'...51 'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n'];52 end53 'time_end=$(date +%%s)\n'... 54 'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n']; 55 end 53 56 54 57
Note: See TracChangeset
for help on using the changeset viewer.
