-
Notifications
You must be signed in to change notification settings - Fork 796
/
initPmtk3Octave.m
50 lines (49 loc) · 1.59 KB
/
initPmtk3Octave.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function initPmtk3Octave()
more off
%% Initialize PMTK3 for Octave
w = which(mfilename());
if w(1) == '.' % for octave compatability
w = fullfile(pwd, w(3:end));
end
thisDir = fileparts(w);
cd(thisDir);
restoredefaultpath();
addpath(genpath(pwd));
% if ~exist('matlabToolsRoot', 'file')
% url = 'http://matlabtools.googlecode.com/svn/trunk/matlabTools.zip';
% fprintf('downloading matlabTools.............');
% dest = fullfile(thisDir, 'matlabTools', 'matlabTools.zip');
% downloadFile(url, dest); % more reliable than unzip(url, ...
% unzip(dest, fileparts(dest));
% addpath(genpath(fullfile(thisDir, 'matlabTools')));
% fprintf('done\n');
% end
%%
pmtkInfoDir = fullfile(thisDir, 'pmtkTools', 'systemInfo');
%% write isOctave function
text = { 'function answer = isOctave()'
'%autogenerated by initPmtk3()'
sprintf('answer = 1;');
'end'
};
writeText(text, fullfile(pmtkInfoDir, 'isOctave.m'));
%% write is*ToolboxInstalled functions
toolbox = {'stats', 'bioinfo', 'optim', 'signal', 'images', 'symbolic',...
'nnet', 'splines'};
for t=1:numel(toolbox)
fname = sprintf('%sToolboxInstalled', toolbox{t});
text = { sprintf('function answer = %s()', fname)
'% autogenerated by initPmtk3()'
sprintf('answer = 0;')
'end'
};
writeText(text, fullfile(pmtkInfoDir, [fname, '.m']));
end
%% include PMTK support
if ~(exist('pmtkSupportRoot', 'file') == 2)
downloadAllSupport();
end
restoredefaultpath();
addpath(genpath(pwd)); % octave path management can be buggy - make sure
disp('welcome to pmtk3');
end