I am trying to plot Depth against Salinity, Temperature and Oxygen collected by a CTD profiler at several stations. Lenght of data is variable depending of water depth at eact station.
My current code is as follow:
subplot(2,3,1)hold on;plot(T1,D1, 'b -');plot(T2,D2, 'r --');title('Perfil Temperatura (°C)')yticks(0:5:100);set(gca,'xaxisLocation','top');set(gca,'YDir','reverse');ylabel('m');legend('Est.1','Est.2','Location','south' ) subplot(2,3,2)hold onplot(S1,D1, 'b -');plot(S2,D2, 'r --');title ('Perfil Salinidad (PSU)')yticks(0:5:100);set(gca,'xaxisLocation','top');set(gca,'YDir','reverse');ylabel('m');legend('Est.1','Est.2', 'Location','south' ) subplot(2,3,3)hold onplot(DO1,D1, 'b -');plot(DO2,D2, 'r --');title ('Perfil Oxígeno (mg/L)')yticks(0:5:100);set(gca,'xaxisLocation','top');set(gca,'YDir','reverse');ylabel('m');legend('Est.1','Est.2', 'Location','south' )
How can I use a loop to come up with a shorter code??
Best Answer