]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | function t = createTable() |
2 | % CREATETABLE Helper function for creating test table. | |
3 | ||
4 | % Licensed to the Apache Software Foundation (ASF) under one or more | |
5 | % contributor license agreements. See the NOTICE file distributed with | |
6 | % this work for additional information regarding copyright ownership. | |
7 | % The ASF licenses this file to you under the Apache License, Version | |
8 | % 2.0 (the "License"); you may not use this file except in compliance | |
9 | % with the License. You may obtain a copy of the License at | |
10 | % | |
11 | % http://www.apache.org/licenses/LICENSE-2.0 | |
12 | % | |
13 | % Unless required by applicable law or agreed to in writing, software | |
14 | % distributed under the License is distributed on an "AS IS" BASIS, | |
15 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |
16 | % implied. See the License for the specific language governing | |
17 | % permissions and limitations under the License. | |
18 | ||
19 | variableNames = {'uint8', ... | |
20 | 'uint16', ... | |
21 | 'uint32', ... | |
22 | 'uint64', ... | |
23 | 'int8', ... | |
24 | 'int16', ... | |
25 | 'int32', ... | |
26 | 'int64', ... | |
27 | 'single', ... | |
28 | 'double'}; | |
29 | ||
30 | variableTypes = {'uint8', ... | |
31 | 'uint16', ... | |
32 | 'uint32', ... | |
33 | 'uint64', ... | |
34 | 'int8', ... | |
35 | 'int16', ... | |
36 | 'int32', ... | |
37 | 'int64', ... | |
38 | 'single', ... | |
39 | 'double'}; | |
40 | ||
41 | uint8Data = uint8([1; 2; 3]); | |
42 | uint16Data = uint16([1; 2; 3]); | |
43 | uint32Data = uint32([1; 2; 3]); | |
44 | uint64Data = uint64([1; 2; 3]); | |
45 | int8Data = int8([1; 2; 3]); | |
46 | int16Data = int16([1; 2; 3]); | |
47 | int32Data = int32([1; 2; 3]); | |
48 | int64Data = int64([1; 2; 3]); | |
49 | singleData = single([1/2; 1/4; 1/8]); | |
50 | doubleData = double([1/10; 1/100; 1/1000]); | |
51 | ||
52 | numRows = 3; | |
53 | numVariables = 10; | |
54 | ||
55 | t = table('Size', [numRows, numVariables], 'VariableTypes', variableTypes, 'VariableNames', variableNames); | |
56 | ||
57 | t.uint8 = uint8Data; | |
58 | t.uint16 = uint16Data; | |
59 | t.uint32 = uint32Data; | |
60 | t.uint64 = uint64Data; | |
61 | t.int8 = int8Data; | |
62 | t.int16 = int16Data; | |
63 | t.int32 = int32Data; | |
64 | t.int64 = int64Data; | |
65 | t.single = singleData; | |
66 | t.double = doubleData; | |
67 | ||
68 | end |