Ignore:
Timestamp:
01/11/20 00:14:42 (5 years ago)
Author:
bduin
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • prdatasets/pr_getdata.m

    r150 r151  
    1111%
    1212% A mat-file returns a structure with fields pointing to stored variables.
    13 % If available, the dataset DSET stored in FIELD (default 1) is returned in
    14 % OUT. In case of a datafile DFILE, it is created, if necessary, with given
     13% If available, the dataset DSET stored in FIELD is returned in OUT. If
     14% FIELD is not set all fields are returned in a cell array.
     15%
     16% In case of a datafile DFILE, it is created, if necessary, with given
    1517% TYPE and returned in OUT. In case the download was successful but no
    1618% dataset or datfile could be created (e.g. because of empty TYPE) OUT is
     
    127129if exist([dsetmat],'file') == 2
    128130  try
    129     s = prload(dsetmat);
     131    out = file2dset(dsetmat);
    130132  catch ME
    131     out = 'error';
    132     return
    133   end
    134   if isstruct(s)
    135     if isempty(field)
    136       f = fieldnames(s);
    137       out = getfield(s,f{1});
     133    s = load(dsetmat);
     134    if isstruct(s)
     135      if isempty(field)
     136        s = struct2cell(s);
     137        out = s{1};
     138      else
     139        out = getfield(s,field);
     140      end
    138141    else
    139       out = getfield(s,field);
     142      out = s;
    140143    end
    141   else
    142     out = s;
    143144  end
    144145elseif exist(dset,'dir') == 7
Note: See TracChangeset for help on using the changeset viewer.