diff functions/funcsMobilab/find_format.m @ 0:2fadb31a9d55 tip

Import code by Vuegen et al
author Dan Stowell <dan.stowell@elec.qmul.ac.uk>
date Fri, 11 Oct 2013 12:02:43 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/functions/funcsMobilab/find_format.m	Fri Oct 11 12:02:43 2013 +0100
@@ -0,0 +1,29 @@
+function [files] = find_format(DIR,format)
+
+i = 1;
+inhoud_DIR = dir(DIR);
+aantal_bestanden = length(inhoud_DIR);
+for j = 1:aantal_bestanden
+    bestandsnaam = inhoud_DIR(j,1).name;
+    if strcmp(format,'map')
+        if inhoud_DIR(j,1).isdir ==true
+            if bestandsnaam(1) ~= '.'
+                files.labels(i) = {bestandsnaam(1:(length(bestandsnaam)-length('01.wav')))};
+                files.names(i) = {bestandsnaam};
+                i = i+1;
+            end
+        end  
+    else
+        if length(bestandsnaam)>=length(format),
+            formaatBestandsnaam = bestandsnaam(end-length(format)+1:end);
+            if strcmp(formaatBestandsnaam, char(ones(1,0)));
+                formaatBestandsnaam = '';
+            end
+            if strcmp(formaatBestandsnaam, format),
+                files.labels(i) = {bestandsnaam(1:(length(bestandsnaam)-length('01.wav')))};
+                files.names(i) = {bestandsnaam};
+                i = i+1;
+            end
+        end
+    end
+end
\ No newline at end of file