source: PlatformSupport/matperf/server/conversion.m

Last change on this file was 951, checked in by chunter, 16 years ago

adding matperf

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1function t1 = conversion(type, t1,repnum)
2
3m = size(repnum);
4byte = 'Bytes';
5kbyte = 'KBytes';
6mbyte = 'MBytes';
7gbyte = 'GBytes';
8bit = 'bits';
9kbit = 'Kbits';
10mbit = 'Mbits';
11gbit = 'Gbits';
12
13if(strcmp(kbyte,repnum) == 1)
14    if(strcmp(type,'Bytes'))
15        t1 = t1*1024;
16       
17    elseif(strcmp(type,'MBytes'))
18        t1 = t1/1024;
19   
20    elseif(strcmp(type,'GBytes'))
21        t1 = t1/(1024*1024);
22    end
23
24elseif(strcmp(mbyte,repnum) == 1)
25    if(strcmp(type,'Bytes'))
26        t1 = t1*1024*1024;
27   
28    elseif(strcmp(type,'GBytes'))
29        t1 = t1/1024;
30   
31    elseif(strcmp(type, 'KBytes'))
32        t1 = t1*1024;
33    end
34
35elseif(strcmp(gbyte,repnum))
36    if(strcmp(type,'Bytes'))
37        t1 = t1*1024*1024*1024*1024;
38   
39    elseif(strcmp(type,'MBytes'))
40        t1 = t1*1024*1024*1024;
41   
42    elseif(strcmp(type, 'KBytes'))
43        t1 = t1*1024*1024;
44    end
45
46elseif(strcmp(byte,repnum))
47    if(strcmp(type,'KBytes'))
48        t1 = t1/1024;
49   
50    elseif(strcmp(type,'MBytes'))
51        t1 = t1/(1024^2);
52   
53    elseif(strcmp(type, 'GBtes'))
54        t1 = t1/(1024*1024*1024);
55    end
56
57%%% from here bits to KMGbits
58elseif(strcmp(bit,repnum))
59    if(strcmp(type ,'Kbits'))
60        t1 = t1/1024;   
61    elseif(strcmp(type, 'Mbits'))
62        t1 = t1/(1024*1024);   
63    elseif(strcmp(type, 'Gits'))
64        t1 = t1/(1024*1024*1024);
65    end
66elseif(strcmp(kbit,repnum))
67    if(strcmp(type, 'bits'))
68        t1 = t1 * 1024;
69    elseif(strcmp(type, 'Mbits'))
70        t1 = t1/1024;
71    elseif(strcmp(type, 'Gbits'))
72        t1= t1/(1024*1024);
73    end
74elseif(strcmp(mbit,repnum))
75    if(strcmp(type,'bits'))
76        t1 = t1*1024*1024;
77    elseif(strcmp(type,'Kbits'))
78        t1 = t1*1024;
79    elseif(strcmp(type,'Gbits'))
80        t1 = t1/1024;
81    end
82elseif(strcmp(gbit,repnum))
83    if(strcmp(type,'bits'))
84        t1 = t1*1024*1024*1024;
85    elseif(strcmp(type, 'Kbits'))
86        t1 = t1*1024*1024;
87    elseif(strcmp(type, 'Mbits'))
88        t1 = t1*1024;
89    end
90end
91return
Note: See TracBrowser for help on using the repository browser.