%% for video

% video file 이름 만들기

vfn = ['ani-01-01-10'];

% video file open

v = VideoWriter(vfn);

open(v);

figure(2);

% 그라운드 만들기

rectangle('Position', [-2 -1 4 1], 'facecolor', 'g');

for i = 1:length(time)

% 잔상 control

    if (op3 == 1)

        n2 = fix((length(time))/n_frame);

    else

        n_frame = 0;

    end

    hold on;

    % Link1, Link2 만들기

    Link1 = line([0 L1_x(i)], [0 L1_y(i)], 'color', 'k', 'Linewidth', 2);

    Link2 = line([L1_x(i) x_p(i)], [L1_y(i) y_p(i)], 'color', 'k', 'Linewidth', 2); 

    % velocity vector 만들기

    vel = quiver(x_p(i), y_p(i), x_pdot(i), y_pdot(i), 'Color', 'g', 'Linewidth', 2);

    % velocity vector 가시화 control

    if (op2 ==0)

        delete(vel);

    end

    % end effector 궤적 만들기

    path = plot(x_p(i), y_p(i), 'o-r', 'MarkerSize', 2);

    % end effector 궤적 control

    if (op1 == 0)

        delete(path);

    end

    % axis로 그래프 setting

    axis equal;

    axis([-7 7 -7 7]);

    % 각관절에 원 만들어 넣기

    r=0.3;

    [x, y] = circle(0,0,r);

    [xx, yy] = circle(L1_x(i), L1_y(i), r);

    [xxx, yyy] = circle(x_p(i), y_p(i), r);

    % 원 색깔 채우기

    cir1 = fill(x, y, 'w');

    cir2 = fill(xx, yy, 'r');

    cir3 = fill(xxx, yyy, 'r');

    F(i) = getframe;

    if(i==length(time)) 

        break;

    end

             if(0==rem(i, n2))

             else

                  delete(Link1);

                  delete(Link2);

                  delete(vel);

             end

    delete(cir1);

    delete(cir2);

    delete(cir3);

end

writeVideo(v, F);

close(v);




경고: 이 파일에는 비디오 프레임이 작성되지 않았습니다. 파일이 유효하지 않을 수 있습니다. 

> In VideoWriter.VideoWriter>VideoWriter.close at 307

  In VideoWriter.VideoWriter>VideoWriter.delete at 256

  In mfile at 83 

다음 사용 중 오류가 발생함: graphicsversion

입력값이 유효한 그래픽스 객체가 아닙니다.


오류 발생: getframe (line 51)

  usingMATLABClasses = ~graphicsversion(parentFig, 'handlegraphics');


오류 발생: mfile (line 123)

    F(i) = getframe;


애니메이션이 빈파일이라뜸 자꾸 대체 이 경고는 왜뜨는거야..  진짜 미쳐버리겟다