annotate _FullBNT/KPMtools/asdemo.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 % ASORT
matthiasm@8 2 % a pedestrian NUMERICAL SORTER of ALPHANUMERIC data
matthiasm@8 3
matthiasm@8 4 % - create some data
matthiasm@8 5 d = {
matthiasm@8 6 % strings with one valid alphanumeric number
matthiasm@8 7 % sorted numerically
matthiasm@8 8 '-inf'
matthiasm@8 9 'x-3.2e4y'
matthiasm@8 10 'f-1.4'
matthiasm@8 11 '-.1'
matthiasm@8 12 '+ .1d-2'
matthiasm@8 13 '.1'
matthiasm@8 14 'f.1'
matthiasm@8 15 'f -+1.4'
matthiasm@8 16 'f.2'
matthiasm@8 17 'f.3'
matthiasm@8 18 'f.10'
matthiasm@8 19 'f.11'
matthiasm@8 20 '+inf'
matthiasm@8 21 ' -nan'
matthiasm@8 22 '+ nan'
matthiasm@8 23 'nan'
matthiasm@8 24 % strings with many numbers or invalid/ambiguous numbers
matthiasm@8 25 % sorted in ascii dictionary order
matthiasm@8 26 ' nan nan'
matthiasm@8 27 '+ .1e-.2'
matthiasm@8 28 '-1 2'
matthiasm@8 29 'Z12e12ez'
matthiasm@8 30 'inf -inf'
matthiasm@8 31 's.3TT.4'
matthiasm@8 32 'z12e12ez'
matthiasm@8 33 % strings without numbers
matthiasm@8 34 % sorted in ascii dictionary order
matthiasm@8 35 ' . .. '
matthiasm@8 36 '.'
matthiasm@8 37 '...'
matthiasm@8 38 '.b a.'
matthiasm@8 39 'a string'
matthiasm@8 40 'a. .b'
matthiasm@8 41 };
matthiasm@8 42 % ... and scramble it...
matthiasm@8 43 rand('seed',10);
matthiasm@8 44 d=d(randperm(numel(d)));
matthiasm@8 45
matthiasm@8 46 % - run ASORT with
matthiasm@8 47 % verbose output: <-v>
matthiasm@8 48 % keep additional results: <-d>
matthiasm@8 49 o=asort(d,'-v','-d');
matthiasm@8 50 % - or
matthiasm@8 51 % p=asort(char(d),'-v','-d');
matthiasm@8 52
matthiasm@8 53 % - show results
matthiasm@8 54 o
matthiasm@8 55 o.anr
matthiasm@8 56
matthiasm@8 57 % - run ASORT with no-space/template options
matthiasm@8 58 % NOTE the impact of -w/-t order!
matthiasm@8 59 s={'ff - 1','ff + 1','- 12'};
matthiasm@8 60 % RAW
matthiasm@8 61 o=asort(s,'-v');
matthiasm@8 62 % remove SPACEs
matthiasm@8 63 o=asort(s,'-v','-w');
matthiasm@8 64 % remove TEMPLATE(s)
matthiasm@8 65 o=asort(s,'-v','-t',{'ff','1'});
matthiasm@8 66 % remove TEMPLATE(s) than SPACEs
matthiasm@8 67 o=asort(s,'-v','-t','1','-w');
matthiasm@8 68 % remove SPACEs than TEMPLATE(s)
matthiasm@8 69 o=asort(s,'-v','-w','-t','1');
matthiasm@8 70