Clear Filters
Clear Filters

How can i create a group consist of some lines and some arrows?

1 view (last 30 days)

I have a code that will create two lines that has black color (from -8 to -4 and -4 to 0) and three arrow. And, i want to create a group from these (two black lines and three arrow). I tried to use hggroup, findobj. But i couldn't do that i want. How can i do? Thank you so much. My code:

clear
clc
% THONG SO BAN DAU CUA BAI TOAN
Ltt=23; % m
V_kmh=30; % (km/h)
deltat=0.001; % (s) % So gia thoi gian
V_ms=V_kmh*1000/3600; % (m/s)
ttotal=Ltt/V_ms; % (s)
tstep=round(ttotal/deltat);
% Tao cac truc do thi
subplot(2,1,1);
axis([-9 24 -0.05 0.1]);
hold
% VE CAC GOI CUA DAN GIAN DON
% Ve goi co dinh
plot([-0.5 0.5 0],[-0.02 -0.02 0],'ro')
line([-0.5 0.5],[-0.02 -0.02])
line([-0.5 0],[-0.02 0])
line([0.5 0],[-0.02 0])
% Ve goi di dong
plot([23 23],[-0.02 0],'ro')
line([23 23],[-0.02 0])
% VE DAM CHU
line([0 23],[0 0])
% TAO RA CAC MUI TEN TAI TRONG CHAY TREN DAM CHU
higharrow=0.04;
Ljump=Ltt/tstep;
% CHO TAI TRONG CHAY QUA CAU
% Xep xe 3 truc len dau cau
arrow([0 higharrow],[0 0],13,'EdgeColor','r','FaceColor','g'); % Truc thu 1
arrow([-4.3 higharrow],[-4.3 0],13,'EdgeColor','r','FaceColor','g'); % Truc thu 2
arrow([-8.6 higharrow],[-8.6 0],13,'EdgeColor','r','FaceColor','g'); % Truc thu 3
line([-8.6 -4.3],[higharrow higharrow],'Color','k');
line([-4.3 0],[higharrow higharrow],'Color','k');

Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!