not getting continuous line when plotting real time data

8 views (last 30 days)
I am not able to get a continuous line when plotting real time data. I have tried using the notations "--r*" and similar to indicate the use of the line and markers, however MATLAB only respects the marker and color indicated, no lines are shown. I tried using 'comet' but it only shows one marker, my Matlab version is R2013b. Below is a section of the code:
keepLooping = true;
while keepLooping
time(count)=toc;
count = count +1;
out = fscanf(s);
fprintf(s, '%s', datestr(now,'yyyy-mmm-dd HH:MM:SS'))
out1 = strsplit(out,',');
s.UserData = count;
p(count) = str2double(out1(12)); %SHARP
k(count) = str2double(out1(11)); %Raw
g(count) = str2double(out1(10)); %Temperature
h(count) = str2double(out1(9)); %Humidity
hold on
plotgraph1 = subplot(2,1,1);
plot(count,p(count),'--mo');
% plotting p
title(['SHARP: Temp = ' num2str(g(count)) 'C, Hum = ' num2str(h(count)) '%']);
xlabel('Time (s)','FontSize',10);
ylabel('Concentration (g/m3)','FontSize',10);
scrollWidth = 10;
delay = .01;
hold on
plotgraph2 = subplot(2,1,2);
plot(count,k(count),'--r*');
% plotting k
title(['SHARP: Temp = ' num2str(g(count)) 'C, Hum = ' num2str(h(count)) '%']);
xlabel('Time (s)','FontSize',10);
ylabel('Raw','FontSize',10);
scrollWidth = 10;
delay = .01;
drawnow
end
  1 Comment
rantunes
rantunes on 3 Mar 2015
Hey,
Am I mistaken or for example here "plot(count,k(count),'--r*');" you are indeed plotting marks? By default, the Matlab plots lines so you don't need to add the last argument to the plot function. If you wish, just add 'r' for the color of the line.
Greets

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!