-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtableMaking.m
More file actions
54 lines (46 loc) · 1.06 KB
/
tableMaking.m
File metadata and controls
54 lines (46 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% tableMaking
% function creates a table to allow for the creation of the GTSP
% INPUTS
% x = x initial points
% y = y initial points that correspond to x
% numBatteryLevels
% OUTPUTS
% T = table that contains all information
% x = x points
% y = y points corresponding to x
% z = z levels corresponding to x
function [T, x, y, z] = tableMaking(x, y, numBatteryLevels)
xNew = [];
yNew = [];
zNew = [];
xTemp = transpose(x);
yTemp = transpose(y);
xTempSize = size(xTemp);
levels = [];
if xTempSize(1) == 1
correctSize = xTempSize(2);
else
correctSize = xTempSize(1);
end
for i = 1:correctSize
levels(end+1) = numBatteryLevels;
end
levelsOrientation = size(levels);
xTemporientation = size(xTemp);
if levelsOrientation(1) ~= xTemporientation(1)
levels = transpose(levels);
end
%groupNames = {'g1'; 'g2'; 'g3'};
T = table(xTemp, yTemp, levels);
%creating multiple x's, y's, & z's
for j = 1:correctSize
for i = 1:numBatteryLevels
xNew(end+1) = xTemp(j);
yNew(end+1) = yTemp(j);
zNew(end+1) = i;
end
end
x = xNew;
y = yNew;
z = zNew;
end