Hi all, I want to assign colour to lines plotted between 3dpoints, based on the values of a fourth vector. The values of the fourth vector are not sorted in any way, and they are both positive and negative values. I did a for loop to plot a line between the nodes that have connectivity, and I'm assigning the color as well. I think I'm having problems with the way I'm sorting the fourth value. But can't figure it out how to make it work. Here is the code:
myColourMap=jet(m);
s=stresses;
[s,I]=sort(s);
for i=1:m
Intensity = I(i);
LineColour=myColourMap(Intensity,:);
plot3([ x(t1(i)) x(t2(i))], [ y(t1(i)) y(t2(i))], [ z(t1(i)) z(t2(i))],'Color', LineColour)
hold on
end
axis equal
colorbar
The four vector is the 's' vector, and when I plotted the network of lines, the colour it assign to each one, does not represent the ascending or descending of the values in vector s(which represent stresses). I appreciate very much any help of how to plot the lines based on the values of a vector, or if the problem is the sorting, then, how to obtain the ordering indices of the vector s.
Thanks a lot in advance
Martha