Minor patch to the Matlab interface
This commit is contained in:
parent
302ca1e02b
commit
2cb9db4a9d
@ -2,12 +2,15 @@ function int=setVerbose(int, bOn, varargin)
|
|||||||
% Activate debug output for the MatlabProblem.
|
% Activate debug output for the MatlabProblem.
|
||||||
% setVerbose(JI, bOn [, dbgfile])
|
% setVerbose(JI, bOn [, dbgfile])
|
||||||
% It is written to a file with given name or to matlabproblem-debug.log
|
% It is written to a file with given name or to matlabproblem-debug.log
|
||||||
% if none is given.
|
% if none is given. To switch file names, first deactivate logging.
|
||||||
% JI: the interface instance
|
% JI: the interface instance
|
||||||
% bOn: 1 activates debug output, 0 deactivates it
|
% bOn: 1 activates debug output, 0 deactivates it
|
||||||
% dbgfile: optional filename
|
% dbgfile: optional filename
|
||||||
%
|
%
|
||||||
|
|
||||||
|
if (nargin<=1)
|
||||||
|
error('Missing argument!');
|
||||||
|
end
|
||||||
if (nargin > 2)
|
if (nargin > 2)
|
||||||
if ischar(varargin{1})
|
if ischar(varargin{1})
|
||||||
fname=varargin{1};
|
fname=varargin{1};
|
||||||
@ -17,7 +20,7 @@ if (nargin > 2)
|
|||||||
disp('Invalid third argument, expected char. Using default output file name');
|
disp('Invalid third argument, expected char. Using default output file name');
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fname=null;
|
fname='';
|
||||||
end
|
end
|
||||||
|
|
||||||
int.mp.setDebugOut( bOn==1, fname);
|
int.mp.setDebugOut( bOn==1, fname);
|
||||||
|
@ -140,12 +140,15 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
|||||||
*/
|
*/
|
||||||
public void setDebugOut(boolean swtch, String fname) {
|
public void setDebugOut(boolean swtch, String fname) {
|
||||||
TRACE=swtch;
|
TRACE=swtch;
|
||||||
|
// System.err.println("setDebugOut: " + swtch +" " + fname);
|
||||||
if (!swtch && (dos != null)) {
|
if (!swtch && (dos != null)) {
|
||||||
dos.close();
|
dos.close();
|
||||||
dos = null;
|
dos = null;
|
||||||
} else if ((dos == null) && swtch) {
|
} else if (swtch && (dos == null)) {
|
||||||
try {
|
try {
|
||||||
dos = new PrintStream(new FileOutputStream(fname==null ? defTestOut : fname));
|
if (fname==null || (fname.length()==0)) fname = defTestOut;
|
||||||
|
// System.err.println("Opening "+fname);
|
||||||
|
dos = new PrintStream(new FileOutputStream(fname));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user