I actually solved the problem, but I will leave this up as an example for anyone else facing similar problems. The updated functional code is:
Legend=cell(N,1);
figure(1)
hold all
for k=1:N
for i=1:length(t1)-1
h_plot(k,i)=plot3([rplot(i,6*k-5); rplot(i+1,6*k-5)],[rplot(i,6*k-4),rplot(i+1,6*k-4)],[rplot(i,6*k-3),rplot(i+1,6*k-3)],'.','Color',ColorSpace(k,:));
end
%Legend{k}=legend(strcat('Body ', num2str(k)));
Legend{k}=strcat('Body ', num2str(k));
end
xlabel('x position')
ylabel('y position')
zlabel('z position')
legend( h_plot(:,1) ,Legend)
I changed Legend to be a list of strings instead of legend handlers. I also modified the legend() command right above to refer specifically to the plot handler indexes.