You can refer to this answer related to the same problem. The way you are doing it is really inefficient and the plotting will become slow as the size of dataset increase because you are creating a new line handle everytime you call plot. You need line handle to update the plot, without calling plot() function again. For your specific case, you can do this as follow
% plot first point outside the while loop to obtain line handles.
i = 0; v1=readVoltage(a, 'A0'); %Analog input for the first NTC temperature sensor v2=readVoltage(a, 'A2'); %Analog input for the second NTC temperature sensor t1=temp(v1); %Here I obtain the temperature with t2=temp(v2); %a function that I will post afterwards y1=t1; y2=t2;
ax = axes(); hold on; line1 = line(i, y1); %handle for line 1 line2 = line(i, y2); %handle for line 2
axis([0 inf 15 30]) %Chose those y-axis values because in normal conditions, temp is aprox 22ºC i = i+1; while(1) %For making the loop infinite v1=readVoltage(a, 'A0'); %Analog input for the first NTC temperature sensor v2=readVoltage(a, 'A2'); %Analog input for the second NTC temperature sensor t1=temp(v1); %Here I obtain the temperature with t2=temp(v2); %a function that I will post afterwards y1=t1; y2=t2; pause(1.0); %line 11 % now only update XData and YData property of line handle; line1.XData = [line1.XData i]; line1.YData = [line1.YData y1]; line2.XData = [line2.XData i]; line2.YData = [line2.YData y2]; i=i+1; end