Extracting data from 4-D double
이전 댓글 표시
Hello-
I am trying to extract individual variables from a 4-D double array. The variable Q (specific humidity) is:
Size: 25x41x6x168
Dimensions: longitude,latitude,level,time
Datatype: int16
I would like to create individual variables for Lon, Lat and Level in order to create a contour plot of Q. Any tips?
Also, seems like a rather basic question but if the 4 dimensions of Q are lon, lat, level and time, where is the data for Q (specific humidity) itself?
댓글 수: 6
Bob Thompson
2021년 1월 15일
편집: Bob Thompson
2021년 1월 15일
If you have a four dimensional array, as you indicate, then the contents of Q are the humidity at corresponding Lon, Lat, Level, and Time. I.e. For your first longitude, first latitude, first level, and first time, the humidity can be found in Q(1,1,1,1).
In order to plot a countor of humidity at the different settings you're going to need to define what those other values are. The size of Q indicates that you should have 25 longitudes, 41 latitudes, 6 levels, and 168 times.
Once you define those then we can talk about making the contour plot.
Raymond Graham
2021년 1월 15일
Bob Thompson
2021년 1월 15일
Yes, those are what I'm thinking of.
As for the contour plot, I don't know if it's possible to create a 5D contour, possibly with some kind of animation, but that's not something I know.
Instead I recommend using contour3, where you make individual plots for each of the different levels and time. The use of this command would look something like the following:
LON = repmat(LON,1,size(LAT,1));
LAT = repmat(LAT',size(LON,1),1);
for i = 1:(size(T,1))
figure(i)
for j = 1:size(LVL,1)
subplot(2,3,j)
contour3(LON,LAT,Q(:,:,1,1))
end
end
Raymond Graham
2021년 1월 15일
Raymond Graham
2021년 1월 15일
Raymond Graham
2021년 1월 15일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

