Getting all pixel values along this line

I want to check how the pixel values along this line have been changing through the different time intervals. This image is shows the mean data values for 36 years, later on i want to compare how the value along this line have been changing through time.
Which MATLAB function I can use to find the values of the pixels along which this line is passing?
figure(1);
clf;
left1 = 0.40;
cb_bottom = 0.060 ;
cb_width = 0.2 ;
cb_height = 0.02 ;
long2 = long(1:4:361,1:4:361);
lat2 = lat(1:4:361,1:4:361);
U2 = mean_wint_u(1:4:361,1:4:361);
V2 = mean_wint_v(1:4:361,1:4:361);
idx = ~isnan(U2) & ~isnan(V2);
m_proj('Stereographic','lat',90,'long',300,'radius',35,'rect','on');
m_contourf(long,lat,mean_wint_rho(:,:),100,'linestyle','none'); mean_wint_rho is 361*361
m_grid('linewi',1,'tickdir','out',...
'xtick',[],'ytick',[]);
m_coast('patch',[.6 .6 .6],'edgecolor','k');
m_elev('contour',[ ],'edgecolor',' ');
m_quiver(long2(idx),lat2(idx),U2(idx),V2(idx),2,'LineWidth',1,'Color','k')
colorbar( 'location','southoutside',...
'position', [left1 cb_bottom cb_width cb_height])
hold on;
m_plot([146.5 -116 -99],[75.5 87 80],'r-'); [% long, lat] values of the line

Answers (1)

4 Comments

Hi Walter.. Thanks for the link, i have already gone through this, but not sure how this fits to my problem.
1. I have the lat/long coordinates for the line and not the x-y which are the raw co-ordinates before changing the EASE grid to Polar Stereographic Projection.
2. What would be the I in this case, as mean_wint_rho is a 361*361 size matrix.
I fixed a few errors with your code then can't get past long() - is that a function in the Mapping Toolbox (which I don't have)? If so, add that to the product list so others don't waste their time too.
It looks like lat and long are just arrays. But the code does use the Mapping Toolbox.
Correction: it uses the third party m_map toolbox

Sign in to comment.

Categories

Asked:

on 13 Jul 2016

Commented:

on 14 Jul 2016

Community Treasure Hunt

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

Start Hunting!