Interpolate gridded matrix row-wise
Show older comments
Hi, I have an 860 by 122 matrix producing a plot below.

I want to interpolate over NaN columns but not all the NaNs in the matrix. I tried using interp function but it gives strange value that are unreasonably wrong. See my code below and attached mat file
figure(1)
pcolor(Y1,Ydepth,sst_up_574); shading flat
set(gca,'Ydir','reverse')
set(gca,'xlim',[bin(1) bin(91)],...
'ylim',[0 500],'fontsize',8,'xminortick','on','yminortick','on')
hold on
hc = colorbar;
rmap=jet(20);
newmap=rmap(2:1:20,:);
colormap(newmap);
caxis([4 23]);
grid on;
box on
set(gca,'Fontweight','bold','Fontsize',16);
set(get(hc,'ylabel'),'string','Water Temperature (^oC)','rotation',270,'verticalalignment','bottom');
ylabel('Depth (m)');
xlabel('Date');
title(['Water Temperature: Upstream SG574'], 'fontweight', 'bold','FontSize',18)
4 Comments
Stephen23
on 18 Oct 2018
@Tumelo Maja: you mention that you tried interpolation, but your code does not mention interpolation anywhere. You attached some data in a .mat file but did not say which variable/s and which values you want to interpolate. Guessing is not an efficient way to write code or provide advice.
Tumelo Maja
on 18 Oct 2018
jonas
on 18 Oct 2018
"I want to interpolate over NaN columns but not all the NaNs in the matrix."
Very ambiguous. Is this what you are looking for? Perhaps you can sketch what NaNs you want to keep?

Tumelo Maja
on 19 Oct 2018
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!