필터 지우기
필터 지우기

How to generate animated gif?

조회 수: 1 (최근 30일)
Dogan Deniz Karadeniz
Dogan Deniz Karadeniz 2019년 6월 17일
댓글: KSSV 2019년 7월 2일
How to generate TEC map as follows?
I would like to do it similarly but my file includes annual data. Therefore, I extracted daily data from annual data such as attached text file.
File structure:
  • 1st column: Year
  • 2nd column: Day of the year
  • 3rd column: Hour
  • 4st column: Latitude
  • 5st column: Longitude
  • 6st column: TEC Values

답변 (1개)

KSSV
KSSV 2019년 6월 17일
Read this to know how to write plots to a gif.
data = importdata('data.txt') ;
y = data(:,1) ;
d = data(:,2) ;
h = data(:,3) ;
lat = data(:,4) ;
lon = data(:,5) ;
t = data(:,6) ;
%
[c,ia,ib] = unique(h) ;
for i = 1:length(c)
X = reshape(lon(ib==i),length(unique(lon)),length(unique(lat))) ;
Y = reshape(lat(ib==1),length(unique(lon)),length(unique(lat))) ;
Z = reshape(t(ib==1),length(unique(lon)),length(unique(lat))) ;
pcolor(X,Y,Z)
shading interp
title(sprintf('Hour = %s',num2str(c(i))))
drawnow
end
  댓글 수: 2
Dogan Deniz Karadeniz
Dogan Deniz Karadeniz 2019년 6월 21일
편집: Dogan Deniz Karadeniz 2019년 6월 21일
How to change title in a loop such for date and time? Your code gives hours but it doesn't show which year, day of the year (or month and day), and hour.
I think it is just for daily. I tried to use your code for double day data but result is pointless. I am so confused.
Error using reshape
To RESHAPE the number of elements must not change.
KSSV
KSSV 2019년 7월 2일
Attach your whole original data with the code you tried.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by