How to plot one column in a martix

2 ビュー (過去 30 日間)
Rascal07
Rascal07 2018 年 2 月 26 日
回答済み: jonas 2018 年 2 月 26 日
I have a matrix of elevation at each latitude and longitude. I have plotted this as a surf plot using:
ncfile = 'chagos_new.nc' ; % nc file name
% To get information about the nc file
ncinfo(ncfile);
% to display nc file
ncdisp(ncfile);
% to read a vriable 'var' exisiting in nc file
elevation = ncread(ncfile,'elevation') ;
lat = ncread(ncfile,'lat') ;
lon = ncread(ncfile,'lon') ;
figure (5)
pcolor(lat,lon,elevation)
shading interp
surf(lat,lon,elevation)
colormap jet
colorbar
shading interp
grid on
title('Chagos Archipelago')
xlabel ('Latitude (^o)')
ylabel ('Longitude (^o)')
zlabel ('Elevation from sea surface level in meters')
colorbar
h = colorbar;
set(get(h,'label'),'string','Depth (m)');
I would like to plot a east west transect of this surf plot as a line plot, possibly with the x axis being distance in km and the y axis being elevation in meters. Does anyone know how to do this? And is there a way to select my transect between two particular lat lon co-ordinates as apposed to just an entire row of a matrix? The work-space is attached, let me know if anything else is needed. Thanks
  1 件のコメント
Adam
Adam 2018 年 2 月 26 日

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

採用された回答

jonas
jonas 2018 年 2 月 26 日
The gridded data is stored in the surface plot's 'ZData' property.
h=surf(lat,lon,elevation) el=get(h,'ZData') plot(lat,el(1,:))
Transforming the coordinates to distance is a bit more complicated. I believe the mapping toolbox has some functions for this.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by