how can i plot my three parameters as line not scatter?

i want to have a line plot but i get this one.
can anybody help me please.
Thank you.
eat=str2double(get(handles.edit1,'String'));
period=Repeat*1;
grid on
xlabel('Time [Minutes]','color','b');
ylabel( '3d-Displacement [Meter]','color','b')
title('Station stability','color','r');
set(gca,'xcolor','b','ycolor','b')
count=0;
while true
tic
t = rand(1);
count=count+1;
plot(count,t)
m=AtmosphericCorr;
m1=m(1);
m2=m(2);
m4=m(4);
hold on;
plot(count,m1,'r--+')
% plot(count,m2,'c--+')
plot(count,m4,'b--o')
plot(count,t,'y--*')
view(handles.axes1)
drawnow
T=toc;
pause(period-T)
end

 Risposta accettata

You need to plot arrays, not single points. So use indexes on m1, m2, and m4 and plot will then use the whole array rather than a single point and then you will get the lines between the points.

6 Commenti

Do you mean this? But it doesn't work. It would be kind if you explain it with an example.
plot(count,m1,'r--+',count,m4,'b--o',count,t,'y--*')
I can't because you didn't provide us with eat.
Did you do something like this:
m1(count)=m(1);
m2(count)=m(2);
m4(count)=m(4);
plot(1:count,m1,'r--+')
plot(1:count,m4,'b--o')
etc.?
MoHa
MoHa il 10 Mar 2020
Modificato: MoHa il 10 Mar 2020
Thanks it works perfekt!
but i have still problem with plotting of " plot(count,t,'k-*') ".
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
% jCmdWin = jDesktop.getClient('Command Window');
% jTextArea = jCmdWin.getComponent(0).getViewport.getView;
% cwText = char(jTextArea.getText);
% d=dlmread('ScanFrame.txt');
plt=animatedline('color','r','Marker','o');
grid on;
hold on;
% here i get the Timer interval from GUI
Repeat=str2double(get(handles.edit1,'String'));
period=Repeat*1;
grid on
xlabel('Time [Minutes]','color','b');
ylabel( '3d-Displacement [Meter]','color','b')
title('Station stability','color','r');
set(gca,'xcolor','b','ycolor','b')
count=0;
while true
tic
t = rand(1);
count=count+1;
plot(count,t)
m=AtmosphericCorr;
m1(count)=m(1);
m2(count)=m(2);
m4(count)=m(4);
m3(count)=m(3);
plot(1:count,m1,'r-*')
plot(1:count,m4,'b-*')
plot(count,t,'k-*')
view(handles.axes1)
drawnow
T=toc;
pause(period-T)
end
Image Analyst
Image Analyst il 10 Mar 2020
Modificato: Image Analyst il 10 Mar 2020
You didn't make the change I suggested. Why not?
How can I run your program? Attach both the .m file and the .fig file with the paper clip icon.
sorry it was a not the corrected one.
Thank you so much Image Analyst for your Help!

Accedi per commentare.

Più risposte (0)

Prodotti

Release

R2017a

Richiesto:

il 10 Mar 2020

Commentato:

il 11 Mar 2020

Community Treasure Hunt

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

Start Hunting!

Translated by