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