diff util/SMALL_learn.m @ 189:75b5dedcfd45 luisf_dev

created initialization file; changing SMALL_learn in order to initialize plugins.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 16 Feb 2012 18:24:43 +0000
parents b14209313ba4
children
line wrap: on
line diff
--- a/util/SMALL_learn.m	Thu Feb 09 17:26:45 2012 +0000
+++ b/util/SMALL_learn.m	Thu Feb 16 18:24:43 2012 +0000
@@ -101,6 +101,40 @@
 %     D = eval([DL.name,'(<Preffered_API>);']);
 
   else
+    % register other toolboxes from the extra plugins folder
+    folders = dir('extra');
+    extra_plugins = folders(arrayfun(@(x) x.name(1), folders) ~= '.');
+    extra_plugins = extra_plugins([extra_plugins.isdir])
+    
+    if length(extra_plugins) > 0
+        printf('Found %i extra plugin(s) in the extra plugins folder.\n', length(extra_plugins));
+        
+        for i=1:length(extra_plugins)
+            printf('Initializing extra plugin "%s"', extra_plugins(i).name);
+            
+            %% adds all files from path
+            genpath(['extra/', extra_plugins(i).name]); 
+            
+            % open plugin's init file 
+            
+            
+            init_file = ['extra/', extra_plugins(i).name, '/init.m'];
+            
+            if ~(exist(init_file == 2)
+                error(['Plugin ', extra_plugins(i).name, ' init file does not exist. Exiting now...'])
+            else
+                % get the correct function handle and run it
+                init_file
+                
+            end
+        end
+            
+    else
+        printf('No extra plugins found.')
+    end
+  
+      
+      
     printf('\nToolbox has not been registered. Please change SMALL_learn file.\n');
     return
   end