Borrar filtros
Borrar filtros

How to change the colour of my line code

21 visualizaciones (últimos 30 días)
Jhon Rackham
Jhon Rackham el 25 de Abr. de 2020
Comentada: Star Strider el 25 de Abr. de 2020
Hi guys, i need your help, I'm working on a line codificator and when I push the buttom for represent it, It appear with a remix of colours, I wanna know if I can change it for only 1 colours. This is my code:
a=str2double(get(handles.uno,'String'));
b=str2double(get(handles.dos,'String'));
c=str2double(get(handles.tres,'String'));
d=str2double(get(handles.cuatro,'String'));
e=str2double(get(handles.cinco,'String'));
f=str2double(get(handles.seis,'String'));
g=str2double(get(handles.siete,'String'));
h=str2double(get(handles.ocho,'String'));
i0=str2double(get(handles.nueve,'String'));
j0=str2double(get(handles.diez,'String'));
handles.bits=[a,b,c,d,e,f,g,h,i0,j0];
handles.cod=get(hObject,'Value');
hold off;
h =handles.bits;
n=1;
h(11)=1;
while n<=10;
t=n-1:0.001:n;
%Graficación de los CEROS (0)
if h(n) == 0
if h(n+1)==0
y=(t>n);
else
y=(t==n);
end
d=plot(t,y);title('Code UNIPOLAR RZ');grid on
set(d,'LineWidth',2.5);
hold on;
axis([0 10 -1.5 1.5]);
%Graficación de los UNOS (1)
else
if h(n+1)==0
y=(t<n-0.5);
else
y=(t<n-0.5)+1*(t==n);
end
d=plot(t,y);title('Code UNIPOLAR RZ');grid on;
set(d,'LineWidth',2.5);
hold on;
axis([0 10 -1.5 1.5]);
end
n=n+1;
end

Respuesta aceptada

Star Strider
Star Strider el 25 de Abr. de 2020
The easiest way to set them all to the same colour is to subscript both the ‘d’ handles:
d(n)=plot(t,y);
then after the loop add:
set(d, 'Color','k')
to set them all to black ('k'), or substitute 'k' for whatever colour you want.
.
  4 comentarios
Jhon Rackham
Jhon Rackham el 25 de Abr. de 2020
Star Strider, I'm trying your method but It fail, can you give me an example using part of my own code please?
Star Strider
Star Strider el 25 de Abr. de 2020
I do not have the information you used with the code you posted, so I cannot run it. (I tried that first, then created my own demonstration code when I could not run yours.)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by