Browse code

starting som prediction fine-tuned class-performance visualisation

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@112 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on21/01/2009 16:34:25
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+function ind = som_cod2ind(msize,cind)
2
+
3
+%SOM_COD2IND Matlab linear index from SOM_PAK style linear indeces.
4
+%
5
+% ind = som_cod2ind(msize,cind)
6
+%
7
+%  ind = som_cod2ind([10 15],44);
8
+%  ind = som_cod2ind(sMap,44);
9
+%  ind = som_cod2ind(sMap.msize,44);
10
+%  ind = som_cod2ind([10 15],[44 13 91]');
11
+%
12
+%  Input and output arguments: 
13
+%   msize  (struct) map or topology struct
14
+%          (vector) size 1 x m, specifies the map grid size
15
+%   cind   (vector) size n x 1, SOM_PAK style linear indeces for n map units
16
+%                   (row first, then column)
17
+% 
18
+%   ind    (vector) size n x 1, Matlab linear indeces
19
+%
20
+% See also SOM_IND2COD.
21
+
22
+% Contributed to SOM Toolbox vs2, January 14th, 2002 by Juha Vesanto
23
+% http://www.cis.hut.fi/projects/somtoolbox/
24
+
25
+% Version 2.0beta juuso 140102
26
+
27
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
+
29
+if isstruct(msize), 
30
+  if strcmp(msize.type,'som_map'), msize = msize.topol.msize; 
31
+  elseif strcmp(msize.type,'som_topol'), msize = msize.msize;
32
+  else error('Invalid first argument.'); end
33
+end
34
+
35
+if nargin<2, cind = 1:prod(msize); end
36
+
37
+I2C = som_ind2cod(msize,[1:prod(msize)]); 
38
+[dummy,C2I] = sort(I2C); 
39
+ind = C2I(cind); 
40
+
41
+return; 
42
+
43
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%