フィルターのクリア

Read First n line then plot and read next lines and plot and collectively make movie of all graphs.

1 回表示 (過去 30 日間)
I am trying to read data from file. Now i would like to read first suppose n=337 lines and plot the data for the same, now repeat same for the next 337 lines and untill the end. Now i would like to make movie of the graphs\plots with same x and y axis generated into single mvi file.
T=readtable('Plug.txt','ReadVariableNames',true);
F = scatteredInterpolant(T.XC, T.YC, T.VY);
[xmin, xmax] = bounds(T.XC);
[ymin, ymax] = bounds(T.YC);
x0 = linspace(xmin, xmax, 409);
y0 = linspace(ymin, ymax, 337);
[xq, yq] = meshgrid(x0, y0);
zq = F(xq, yq);
this is how i am planning to go ahead with reading the file but how to loop and save all the plots into animation. One of the static images can be found below but what i want is that movie whcih procceds with first showing y=0 data and then y=1 y=2.... till y=87.

採用された回答

KSSV
KSSV 2022 年 8 月 24 日
T=readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1106475/Plug.txt\Plug.txt','ReadVariableNames',true);
x = T.XC ;
y = T.YC ;
vy = T.VY ;
xv = unique(x) ;
yv = unique(y) ;
nx = length(xv) ;
ny = length(yv) ;
figure(1)
filename = 'test.gif';
for i = 1:ny
plot(x(y==y(i)),vy(y==y(i)))
ylim([-8 1])
drawnow
frame = getframe(1);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if i == 1
imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
else
imwrite(imind,cm,filename,'gif','WriteMode','append');
end
end
  1 件のコメント
Yashvardhan Bhati
Yashvardhan Bhati 2022 年 8 月 27 日
Thank you for the solution, works perfectly. If possible can you tell how to save it as avi file and not gif format.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by