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