clc
clear all

s=serial('COM23','BaudRate',115200);
set(s,'Terminator','CR');
fopen(s);

for (i=1:1:20) 
    RTD = fgets(s);
    TC = fgets(s);
    PT100 = fgets(s);
    fgets(s);
    x(i)=str2num(RTD(2:11));
    x2(i)=str2double(TC(2:11));
    x3(i)=str2double(PT100(2:11));%PT100(1:i)
    
    y = 1:1:i;
    
        subplot(3,1,1)
    plot(y, x, 'rx-')
    axis( [ 0, i+1, 20, 30 ] );
    grid on; 
    title('The graphic of RTD'); 
    %xlabel('Cislo mereni'); 
    ylabel('Teplota[°C]'); 

        subplot(3,1,2) 
    plot(y, x2, 'rx-')
    axis tight;%axis( [ 0, i+1, 20, 40 ] );
    grid on; 
    title('The graphic of TC'); 
    %xlabel('Cislo mereni'); 
    ylabel('Teplota[°C]'); 

        subplot(3,1,3) 
    plot(y, x3, 'rx-')
    axis tight;%axis( [ 0, i+1, 20, 40 ] );
    grid on; 
    title('The graphic of PT100'); 
    xlabel('Cas[s]'); 
    ylabel('Teplota[°C]'); 
   % text(3.05,0.16,'\downarrow RTD');
 
end;
fclose(s);