combine Latitude and longitude country data from multiple arrays into one array
Mostrar comentarios más antiguos
I have an array (MYD_countries) of size 249*64800 in which the first dimension represents different countries in the world and the second dimension represents global data grid cells of 1-degree data (180*360 = 64800). Each country data has data values within the country grid points and NaN elsewhere. I want to combine the data of all countries together and reduce its dimension to 1*64800 so that I can plot it at one call using geoshow. I have tried it using a loop as below but it is only storing the last country data, not all country data. Could anybody help please?
for i = 1:249;
for j = 1:64800;
if(MYD_countries(i, j) ~= NaN);
MYD_all_countries_plot (1, j) = MYD_countries (i, j);
else;
end;
end;
end;
Respuesta aceptada
Más respuestas (1)
KSSV
el 22 de Jul. de 2021
Let A be your data of size 249*64800
[m,n] = size(A) ;
iwant = zeros(180,360,m) ;
for i = 1:m
iwant(:,:,i) = reshape(A(i,:),180,360) ;
end
Now iwant variable is a 3D matrix of size 180*360*249; each 2D matrix represents a country. You can plot it now.
3 comentarios
Sagar Parajuli
el 22 de Jul. de 2021
Editada: Sagar Parajuli
el 22 de Jul. de 2021
KSSV
el 22 de Jul. de 2021
USe the variable iwant(:,:,i) which is a 2D matrix using geoshow.
Sagar Parajuli
el 22 de Jul. de 2021
Categorías
Más información sobre Create Plots on Maps en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!