Hi Kianna,
I understand you want to visualize the connections between different data points stored in a cell array. I tried to visualize the connections on a smaller data set(2x2x2) than the one you are using. So I first created the cell array that contains the data as follows:
n = 2;
M{1,1,1} = [3 4];
M{1,1,2} = 1;
M{1,2,1} = [5 6 7];
M{1,2,2} = [7 1];
M{2,1,1} = [2 8 4];
M{2,1,2} = [2 5];
M{2,2,1} = 3 ;
M{2,2,2} = [3 5];
where each number (1:8) represent an index from the indices vector as follows:
indices = [1 1 1;1 1 2; 1 2 1; 1 2 2;2 1 1; 2 1 2; 2 2 1; 2 2 2];
Finally, you can create a matrix that contains all connection and separate each two 3D points by a 'nan' to make sure that MATLAB does not add unnecessary connections between points. Here is a sample code demonstrating this:
plotM = [];
for i = 1: n
for j = 1:n
for k = 1:n
newPoint = M{i,j,k};
numOfConnections = length(newPoint);
for l = 1: numOfConnections
p = indices(newPoint(l),:);
newM = [i j k; p ; nan nan nan];
plotM = [plotM ;newM];
end
end
end
end
plot3(plotM(:,1),plotM(:,2),plotM(:,3),'b');
You can simply generalize that code by using your data set instead of 'M' and put 'n = 128'.
I hope this helps,
Ghada