-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImportData.m
More file actions
40 lines (32 loc) · 1.25 KB
/
ImportData.m
File metadata and controls
40 lines (32 loc) · 1.25 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
%File to import Data to make Adj Matrix and Connection Matrix
%Calls Data File and is called by main alg. function
%rawData is a 3 colm. matrix that has the x, y, z coordinates of each point
%Each node's number matches its index
%A node's connections can be found in the connection matrix at the index
function [connections, connMatrix, rawData] = ImportData()
%Import Data
rawData = importdata('stepData.csv');
nodeLabels = importdata('nodeLabels.csv');
connections = importdata('connectionLabels.csv');
dataLen = size(rawData,1);
%Make Matrix
connMatrix = zeros(dataLen, dataLen); % A 17 by 17 matrix that shows if nodes are connected or not
for i = 1:dataLen
for j = 1:dataLen
valToStore = 0;
nodeANum = nodeLabels(i);
nodeBNum = nodeLabels(j);
if(nodeANum == nodeBNum)
valToStore = 0;
else
for p = 1:size(connections, 2)
%iterate through all the connections of Node A
if(connections(nodeANum, p) == nodeBNum)
valToStore = 1;
end
end
end
connMatrix(i,j) = valToStore;
end
end
end