-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeuronPlotFromData.m
41 lines (34 loc) · 1.3 KB
/
NeuronPlotFromData.m
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
function NeuronPlotFromData(inputData)
% It does not take the file path like Neuron3DPlot.m. Rather it takes
% the input data in N*7 matrix, where N = number of samples.
wMax = max(inputData(3:end,6));
wMin = min(inputData(3:end,6));
tmp = 2*(inputData(:,6)-wMin)/(wMax-wMin)+0.5;
inputData(:,6) = tmp;
totalNode = inputData(end,1);
figure,plot3(inputData(1,3),inputData(1,4),inputData(1,5),'r','MarkerSize',10);view(0,90)
hold on
for k = 2:totalNode
pt1 = inputData(k,3:5);
pt2 = inputData(inputData(k,7),3:5);
pt = [pt1;pt2];
if inputData(k,2)==1
plot3(pt(:,1),pt(:,2),pt(:,3),'-r','LineWidth',5*inputData(k,6));
elseif inputData(k,2)==2
plot3(pt(:,1),pt(:,2),pt(:,3),'-m','LineWidth',5*inputData(k,6));
elseif inputData(k,2)==3
plot3(pt(:,1),pt(:,2),pt(:,3),'-g','LineWidth',5*inputData(k,6));
elseif inputData(k,2)==4
plot3(pt(:,1),pt(:,2),pt(:,3),'-y','LineWidth',5*inputData(k,6));
elseif inputData(k,2)==5
plot3(pt(:,1),pt(:,2),pt(:,3),'-b','LineWidth',5*inputData(k,6));
elseif inputData(k,2)==6
plot3(pt(:,1),pt(:,2),pt(:,3),'-k','LineWidth',5*inputData(k,6));
end
xlim([-70 70]);
ylim([-70 70]);
zlim([-70 70]);
hold on
end
hold off
end