giving color to output result

1 view (last 30 days)
Alperen Koyuncu
Alperen Koyuncu on 8 Jun 2020
Answered: Tommy on 9 Jun 2020
hi guys,
can ı give color to results? I added the code I wrote below. The results of R1,R2,R3 should appear red and L1,L2,L3 should appear yellow. Is ıt possible to do that ?
alphav=input ('alphav girin');
alphac=input ('alphac girin');
L1=-alphav/2;
R1=(-alphav/2)+alphav;
L2=-(alphav/2)-alphac;
R2=(-alphav/2)-alphac+alphav;
L3=-(alphav/2)-(2*alphac);
R3=(-alphav/2)+alphav+alphav-(2*alphac);
if L1<0
L1=L1+720;
end
if L2<0
L2=L2+720;
end
if L3<0
L3=L3+720;
end
if R1<0
R1=R1+720;
end
if R2<0
R2=R2+720;
end
if R3<0
R3=R3+720;
end
L11=L1+360;
L22=L2+360;
L33=L3+360;
R11=R1+360;
R22=R2+360;
R33=R3+360;
if L11>720
L11=L11-720
end
if L22>720
L22=L22-720
end
if L33>720
L33=L33-720
end
if R11>720
R11=R11-720
end
if R22>720
R22=R22-720
end
if R33>720
R33=R33-720

Answers (1)

Tommy
Tommy on 9 Jun 2020
If you mean output to the command window, see this file exchange contribution from Yair Altman:
Generally, if you want better control over the text which is printed to the command window, I would recommend using fprintf() or maybe disp() (or in this case cprintf()) rather than relying on display(), which is what you are doing by omitting semi-colons.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!