Extracting data from matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ahmet Hakan UYANIK
am 2 Mai 2021
Beantwortet: Chad Greene
am 2 Mai 2021
Hi,
I have a matrix A with the size of 127x6750 which is longitude and latitude when plotted covering the world. Also matrix B with the same size but consist of zeros and ones; zeros corresponds to ocean, ones corresponds to land.
So when i plot this, I just want to plot data corresponds to ocean. How can i combine both and plot only one feature?
0 Kommentare
Akzeptierte Antwort
Chad Greene
am 2 Mai 2021
To only plot the ocean data, try masking out the land data by setting those values in A to NaN. like this:
A(B==1) = NaN; % sets land grid cells to NaN
pcolor(lon,lat,A)
shading flat
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Oceanography and Hydrology finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!