Last change
on this file since 686 was
606,
checked in by sommeria, 12 years ago
|
bug on compilation solved (still to test with transform_field fct). faster browser inrtroduced. Various bug corrections
|
File size:
1.5 KB
|
Line | |
---|
1 | %'compile': compile a Matlab function, create a binary in a subdirectory /bin |
---|
2 | %-------------------------------------------------------------------- |
---|
3 | % compile (FctName) |
---|
4 | % |
---|
5 | %INPUT: |
---|
6 | %FctName: name of the Matlab fct to compile (without .m extension) |
---|
7 | % |
---|
8 | function compile (FctName,SubfctPath) |
---|
9 | if isempty(which('mcc')) |
---|
10 | msgbox_uvmat('no Matlab compiler toolbox mcc installed') |
---|
11 | return |
---|
12 | end |
---|
13 | disp(['compiling ' FctName ' ...']) |
---|
14 | % commands to compile civ_matlab and eventually other functions |
---|
15 | if ~exist('bin','dir') |
---|
16 | [success,errormsg]=mkdir('bin'); |
---|
17 | if success~=1 |
---|
18 | display(errormsg) |
---|
19 | end |
---|
20 | end |
---|
21 | if ~isempty(SubfctPath) |
---|
22 | SubfctPath=['-I ' SubfctPath];%string indicating the option of including the path SubfctPath |
---|
23 | end |
---|
24 | disp(['mcc -m -R -nojvm -R -nodisplay ' SubfctPath ' ' FctName '.m']) |
---|
25 | eval(['mcc -m -R -nojvm -R -nodisplay ' SubfctPath ' ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName '.sh] |
---|
26 | %eval(['mcc -m -R -nojvm -R -nodisplay ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName |
---|
27 | system(['mv -f ' FctName ' bin/']);%move the binary file FctName to the subdir /bin |
---|
28 | system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctName '.sh']);%modify the cmd file and copy it to [FctName '.sh'] |
---|
29 | system(['rm run_' FctName '.sh']);% remove the initial cmd file [run_' FctName '.sh] |
---|
30 | system(['chmod +x ' FctName '.sh']); % set the cmd file to 'executable' |
---|
31 | display('** END **') |
---|
32 | end |
---|
33 | |
---|
34 | |
---|
35 | |
---|
Note: See
TracBrowser
for help on using the repository browser.