1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do i create play and stop button for animation?

  1. Nov 26, 2013 #1
    i have created my animation :

    function plot_pix(v,t)

    %project 2d pictures

    view = [1 0 0 ; 0 1 0]; % projection matrix for 2D pictures
    dim = .8e13; %limit of figure
    plot(v(:,1),v(:,2),'r.'); %plotting red masses
    hold on;

    %plot(v(1,1),v(1,2),'y*');-plottint green point

    scatter(v(1,1),v(1,2),15,'filled','green'); %a star as the centre for all planets
    axis([-dim dim -dim dim]); %limits of figure

    axis square %set the figure axis to fit tightly around the data so that the planets which bounce more outwards still can be seen
    title(['No. of Steps : ' num2str(t) ]); %title of figure
    hold off
    shg; % show the most recent figure in window
    pause(.02);
    end

    i want to add the play and stop function in it. how do i do it?
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?