フィルターのクリア

Animating a circle based on diameter data

1 回表示 (過去 30 日間)
Kelly McGuire
Kelly McGuire 2018 年 4 月 26 日
編集済み: Ameer Hamza 2018 年 4 月 27 日
I have two columns of data. In one is the frame number (which I may convert to time in nanoseconds) and in the other is the diameter of an object at that frame or time. I would like to create an animated circle, where the circle is animated based on the changing diameter. For example, at frame 0 the diameter is 10 nanometers, at frame 1 the diameter is 9.5 nanometers, at frame 2 the diameter is 9 nanometers, and so on for about 4,000 frames. I would like to create a circle that is animated, changing by those diameters per frame. Can someone help with this? Thanks!

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 4 月 26 日
編集済み: Ameer Hamza 2018 年 4 月 27 日
Here is a general sketch to create such animation. This code will write the animation frames to a video, you can modify the code according to your requirement.
animationWriter = VideoWriter('animation_file');
open(animationWriter);
for i=1:4000
% create data for circle plot or any other processing you want to do
f = ....; % write your plotting command here using plot() or any other graphics primitive
frame = getframe(gcf);
writeVideo(animationWriter, frame);
end
close(animationWriter);
  3 件のコメント
Kelly McGuire
Kelly McGuire 2018 年 4 月 27 日
Thanks for the help! Couple of questions. 1) Is 'animation_file' the name I want to give my file and without quotes? 2) How does the i=4000 know to use a column of data points? 3) Forgive my novice status, but how would the f = ... part know to use the data points in my column as the diameter of the circle? Thanks!
Ameer Hamza
Ameer Hamza 2018 年 4 月 27 日
1) You will need to input file name in quotes e.g. 'myFile'.
2) I put ... in my code for you to fill. You can write your own code there. You can plot whatever you want there and it will create an animation based on plots you create.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by