Hi i am new with matlab and i have the following code but it does not display the movie

for anim = 1
for nextframe =1;
coordinates = k_R *coordinates(:,:)+net_forces(:,:);
x = coordinates(:,1);
y = coordinates(:,2);
z = coordinates(:,3);
scatter3(x,y,z,'k','filled');
for k1=1:N
for k2 = k1+1:N
if adj(k1,k2)==1
xpair = [x(k1),x(k2)];
ypair = [y(k1),y(k2)];
zpair = [z(k1),z(k2)];
hold on
plot3(xpair,ypair,zpair,'-k');
hold off
end
end
end
end
M(nextframe)=getframe;
nextframe = nextframe+1;
end movie(M,20)

 Accepted Answer

Does this example from the help work for you:
Z = peaks;
figure('Renderer','zbuffer');
surf(Z);
axis tight;
set(gca,'NextPlot','replaceChildren');
for j = 1:20
surf(sin(2*pi*j/20)*Z,Z)
F(j) = getframe;
end
movie(F,20) % Play the movie twenty times

4 Comments

Thank you Image Analyst but the example is familiar to me and it does not help at all can someone explain it on my code
You shouldn't have accepted the answer then. And you didn't answer the question if it works for you or not. I gave that because I have no knowledge of what your variables coordinates and net_forces are. Can you supply code that will generate sample values for them so that we can run your actual code to figure out why your code doesn't work but the example from the help does?
OK, we're getting somewhere. We could get further if you would assist, for example by supplying data like I asked for. I'll wait until that happens - I won't do anything further on your question until I can.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!