Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[a12f41]: ltfatstart.m Maximize Restore History

Download this file

ltfatstart.m    156 lines (124 with data), 3.9 kB

  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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
function ltfatstart()
%LTFATSTART Start the LTFAT toolbox.
% Usage: ltfatstart;
%
% LTFATSTART starts the LTFAT toolbox. This command must be run
% before using any of the functions in the toolbox. If you issue a
% CLEAR ALL then you must call LTFATSTART again.
%
% To configure default options for functions, you can use the the
% LTFATSETDEFAULTS functions in your startup script. A typical startup
% file could look like:
%
%C addpath('/path/to/my/work/ltfat');
%C ltfatstart;
%C ltfatsetdefaults('sgram','nocolorbar');
%
% This will add the main LTFAT directory to you path, start the
% toolbox, and configure SGRAM to not display the colorbar.
%
% See also: ltfatsetdefaults, ltfatmex, ltfathelp
% AUTHOR : Peter Soendergaard.
% TESTING: NA
% REFERENCE: NA
%% ------- Settings: ----------------------------------
% --- general settings ---
% Print the banner at startup?
printbanner=1;
% ----------------------------------------------------
% ------- do not edit below this line ------------
%%----------------------------------------------------
% Get the basepath as the directory this function resides in.
% The 'which' solution below is more portable than 'mfilename'
% becase old versions of Matlab does not have "mfilename('fullpath')"
basepath=which('ltfatstart');
% Kill the function name from the path.
basepath=basepath(1:end-13);
% add the base path
addpath(basepath);
bp=[basepath,filesep];
% Load the version number
[FID, MSG] = fopen ([bp,'ltfat_version'],'r');
if FID == -1
error(MSG);
else
ltfat_version = fgetl (FID);
fclose(FID);
end
%% ----------- install the modules -----------------
modules={};
nplug=0;
% List all files in base directory
d=dir(basepath);
for ii=1:length(d)
% We only look for directories
if ~d(ii).isdir
continue;
end;
% Skip the default directories . and ..
if (d(ii).name(1)=='.')
continue;
end;
% Skip directories without an init file
name=d(ii).name;
% CThe file is a directory and it does not start with '.' This could
% be a module
if ~exist([bp,name,filesep,name,'init.m'],'file')
continue
end;
% Now we know that we have found a module
% Set 'status' to zero if the module forgets to define it.
status=0;
module_version=ltfat_version;
% Add the module dir to the path
addpath([bp,name])
% Execute the init file to see if the status is set.
eval([name,'init']);
if status>0
if status==1
nplug=nplug+1;
modules{nplug}.name=name;
modules{nplug}.version=module_version;
end;
else
% Something failed, restore the path
rmpath([bp,name]);
end;
end;
% Check if Octave was called using 'silent'
%if isoctave
% args=argv;
% for ii=1:numel(args)
% s=lower(args{ii});
% if strcmp(s,'--silent') || strcmp(s,'-q')
% printbanner=0;
% end;
% end;
%end;
if printbanner
s=which('comp_pgauss');
if isempty(s)
error('comp_pgauss not found, something is wrong.')
end;
if strcmp(s(end-1:end),'.m')
backend = 'LTFAT is using the script language backend.';
else
if isoctave
backend = 'LTFAT is using the C++ Octave backend.';
else
backend = 'LTFAT is using the MEX backend.';
end;
end;
banner = sprintf(['LTFAT version %s. Copyright 2011 Peter L. Soendergaard. ' ...
'For help, please type "ltfathelp". %s'], ...
ltfat_version,backend);
disp(banner);
end;
%% ---------- load information into ltfathelp ------------
% As comp is now in the path, we can call ltfatarghelper
ltfatsetdefaults('ltfathelp','versiondata',ltfat_version,...
'modulesdata',modules);
%% ---------- other initializations ---------------------
% Force the loading of FFTW, necessary for Matlab 64 bit on Linux. Thanks
% to NFFT for this trick.1
fft([1,2,3,4]);