annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/mirgetrange.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function r = mirgetrange(x)
Daniel@0 2
Daniel@0 3 if isempty(x)
Daniel@0 4 r = {};
Daniel@0 5 return
Daniel@0 6 end
Daniel@0 7
Daniel@0 8 if isstruct(x)
Daniel@0 9 fields = fieldnames(x);
Daniel@0 10 for f = 1:length(fields)
Daniel@0 11 d.(fields{f}) = mirgetrange(x.(fields{f}));
Daniel@0 12 end
Daniel@0 13 return
Daniel@0 14 end
Daniel@0 15
Daniel@0 16 if iscell(x)
Daniel@0 17 x = x{1};
Daniel@0 18 end
Daniel@0 19 v = get(x,'Data');
Daniel@0 20 if isa(x,'mirscalar')
Daniel@0 21 m = get(x,'Mode');
Daniel@0 22 end
Daniel@0 23
Daniel@0 24 if isa(x,'mirclassify')
Daniel@0 25 d = get(x,'Data');
Daniel@0 26 return
Daniel@0 27 end
Daniel@0 28
Daniel@0 29 if isa(x,'miremotion')
Daniel@0 30 return
Daniel@0 31 end
Daniel@0 32
Daniel@0 33 if isa(x,'mirsimatrix')
Daniel@0 34 return
Daniel@0 35 end
Daniel@0 36
Daniel@0 37 pv = get(x,'PeakVal');
Daniel@0 38 if not(isempty(pv)) && not(isempty(pv{1})) && not(isempty(pv{1}{1}))
Daniel@0 39 d = uncell(pv);
Daniel@0 40 else
Daniel@0 41 d = uncell(v,isa(x,'mirscalar'));
Daniel@0 42 end
Daniel@0 43
Daniel@0 44 if not(iscell(d))
Daniel@0 45 d = {d};
Daniel@0 46 end
Daniel@0 47 r = [];
Daniel@0 48 for i = 1:length(d)
Daniel@0 49 r = [r;d{i}(:)];
Daniel@0 50 end
Daniel@0 51 r = sort(r);