Index: /prdatasets/flowcyto.m
===================================================================
--- /prdatasets/flowcyto.m	(revision 150)
+++ /prdatasets/flowcyto.m	(revision 151)
@@ -25,36 +25,23 @@
 
 if nargin < 1 || isempty(n)
-  n = 1;
+  n = 0;
 end
 
-if any(n<1) || any(n>4)
+if any(n<0) || any(n>4)
   error('Dataset number should be larger than 0 and smaller than 5')
 end
 
-d = pr_getdata('http://prtools.tudelft.nl/prdatasets/FlowCyto_sort.mat',5);
-
-a = cell(1,numel(n));
-for j=1:numel(n)
-  x = prdataset(d{n(j)});
-  x = setname(x(:,2:255),['Flow Cytometry ' num2str(n(j))]);
-  desc = ['These datasets are based on 612 FL3-A DNA flowcytometer histograms' ...
-  'from breast cancer tissues in 256 resolution. The initial data have been' ...
-  'acquired by M. Nap and N. van Rodijnen of the Atrium Medical Center in' ...
-  'Heerlen, The Netherlands, during 2000-2004, using tubes 3-6 of a DACO' ...
-  'Galaxy flowcytometer (N = 1-4). Histograms are labeled in 3 classes:' ...
-  'aneuploid (335 patients), diploid (131) and tetraploid (146). The first' ...
-  'and the last bin (1 and 256) are set to 0, as they contsin noise. After' ...
-  'that histograms are normalized (sum to one) resulting in a dataset with' ...
-  '254 features.'];
-  ref = {['']};
-  x = setprior(x,getprior(x,0));
-  x = setuser(x,desc,'desc');
-  x = setuser(x,ref,'ref');
-  a{j} = x;
+a = pr_loadmatfile(['flowcyto_' num2str(n)]);
+if isempty(a)
+  d = pr_getdata('http://prtools.tudelft.nl/prdatasets/FlowCyto_sort.mat',5);
+  matfile = fullfile(fullfile(fileparts(which(mfilename)),'data'),'flowcyto');
+  b = [];
+  for i=1:4
+    a = setname(prdataset(d{i}),['Flow Cytometry Tube_' num2str(i+2)]);
+    save([matfile '_' num2str(i)],'a');
+    b = [b a];
+  end
+  a = setname(b,'Flow Cytometry');
+  save([matfile '_0'],'a');
+  a = pr_loadmatfile(['flowcyto_' num2str(n)]);
 end
-
-if numel(a) == 1
-  a = a{1};
-end
-
-
Index: /prdatasets/pr_download_uci.m
===================================================================
--- /prdatasets/pr_download_uci.m	(revision 150)
+++ /prdatasets/pr_download_uci.m	(revision 151)
@@ -172,7 +172,8 @@
   if exist([filenames{j} '.mat'],'file') == 2
     % if mat-file is available, use it
-    s = load([filenames{j} '.mat']);
-    f = fieldnames(s);
-    a = getfield(s,f{1});
+%     s = load([filenames{j} '.mat']);
+%     f = fieldnames(s);
+%     a = getfield(s,f{1});
+    a = file2dset([filenames{j} '.mat']);
   else
     if ~exist('data','var')
Index: /prdatasets/pr_getdata.m
===================================================================
--- /prdatasets/pr_getdata.m	(revision 150)
+++ /prdatasets/pr_getdata.m	(revision 151)
@@ -11,6 +11,8 @@
 %
 % A mat-file returns a structure with fields pointing to stored variables.
-% If available, the dataset DSET stored in FIELD (default 1) is returned in
-% OUT. In case of a datafile DFILE, it is created, if necessary, with given
+% If available, the dataset DSET stored in FIELD is returned in OUT. If
+% FIELD is not set all fields are returned in a cell array.
+%
+% In case of a datafile DFILE, it is created, if necessary, with given
 % TYPE and returned in OUT. In case the download was successful but no
 % dataset or datfile could be created (e.g. because of empty TYPE) OUT is
@@ -127,18 +129,17 @@
 if exist([dsetmat],'file') == 2
   try
-    s = prload(dsetmat);
+    out = file2dset(dsetmat);
   catch ME
-    out = 'error';
-    return
-  end
-  if isstruct(s)
-    if isempty(field)
-      f = fieldnames(s);
-      out = getfield(s,f{1});
+    s = load(dsetmat);
+    if isstruct(s)
+      if isempty(field)
+        s = struct2cell(s);
+        out = s{1};
+      else
+        out = getfield(s,field);
+      end
     else
-      out = getfield(s,field);
+      out = s;
     end
-  else
-    out = s;
   end
 elseif exist(dset,'dir') == 7
Index: /prdatasets/pr_loadmatfile.m
===================================================================
--- /prdatasets/pr_loadmatfile.m	(revision 150)
+++ /prdatasets/pr_loadmatfile.m	(revision 151)
@@ -24,11 +24,16 @@
   name = pr_callername;
 end
-matfile = fullfile(fullfile(fileparts(which(name)),'data'),name);
+matfile = fullfile(fullfile(fileparts(which(mfilename)),'data'),name);
+if exist([matfile '.mat'],'file') ~= 2,
+  return
+end
 
 if nargout == 1
-  varargout{1} = loadmatf([matfile '.mat']);
+%   varargout{1} = loadmatf([matfile '.mat']);
+  varargout{1} = file2dset([matfile '.mat']);
 else
   for i=1:nargout
-    varargout{i} = loadmatf([matfile '_' num2str(i) '.mat']);
+%     varargout{i} = loadmatf([matfile '_' num2str(i) '.mat']);
+    varargout{i} = file2dset([matfile '_' num2str(i) '.mat']);
   end
 end
Index: /prdatasets/pr_showdsets.m
===================================================================
--- /prdatasets/pr_showdsets.m	(revision 150)
+++ /prdatasets/pr_showdsets.m	(revision 151)
@@ -2,5 +2,6 @@
 
 forget = {'Contents','mfeat_all','check_','pr_'};
-commands = struct2cell(dir('*.m'));
+dirr = fileparts(which(mfilename));
+commands = struct2cell(dir(fullfile(dirr,'*.m')));
 commands = commands(1,:);
 L = strmatch('pr_',commands);
