MATLAB: How to draw a plot containing the salinity evolution in time at every point of latitude and longitude of a dataset

latlonplotsalinity

Hello everyone,
I'm new to MATLAB and I have to use it during my internship. They're asking me to do this task and I can't figure it out :
I have a dataset containing different values of salinity, time, latitude and longitude.
And I must do a plot containing the salinity evolution in time at every point of latitude and longitude of the dataset. Here is what I've done so far, by taking values I already know for lat and lon because my teacher told me it would be easier by doing so :
% File to read
file_in = 'ModelRPT_Salinity_Example20141118.hdf5';
%% MAIN
[xx,yy,time,ff] = ReadMohidFieldSimple(file_in,'salinity'); % with xx longitude, yy latitude, time, ff salinity
% Longitude
lon = -1,6 ;
% Index of the matrix longitude
x=find(xx == lon)
% Latitude
lat = 43,52 ;
% Index of the matrice Latitude
y = find (yy == lat)
plot(time,squeeze(ff(x,y,:)),'r')
ylabel('Salinity (mg/kg)')
xlabel('Time')
title('Evolution of salinity in time')
datetick
My teacher suggest I should use the function "find" to do so, but I can't find anything that's working. Everytime it says that it's "empty matrix : 0 by 1"
Thanks for reading and I hope someone can help!

Best Answer

Thanks it really helped a lot! Now it works ;)
Have a good day!
Related Question