Set facecolor in app designer

2 visualizaciones (últimos 30 días)
voxynn
voxynn el 25 de Sept. de 2020
Comentada: Ameer Hamza el 25 de Sept. de 2020
I have a circle in AppDesigner with different segments and I want to set the color of each segment individually. When I use the code below I get an error:
"Error using matlab.ui.control.UIAxes/set. Invalid parameter/value pair arguments."
However the same approch (without the app.UIAxes handle) works as expected in a normal script. Can someone point out to me where I might be going wrong?
x0=0;
r=10;
y0=0;
t1 = linspace(0,pi);
t2 = linspace(pi,2*pi);
x1 = x0 + r*cos(t1);
y1 = y0 + r*sin(t1);
x2 = x0 + r*cos(t2);
y2 = y0 + r*sin(t2);
pie=fill(app.UIAxes,[x0,x1,x0],[y0,y1,y0],'w-',...
[x0,x2,x0],[y0,y2,y0],'w-');
axis(app.UIAxes, 'equal');
box(app.UIAxes, 'off');
axis(app.UIAxes,'off');
set(app.UIAxes,pie(1),'facecolor',[255 85 180]./255);
set(app.UIAxes,pie(2),'facecolor',[255 0 0]./255);

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 25 de Sept. de 2020
No need to pass app.UIAxes in these lines
set(pie(1),'facecolor',[255 85 180]./255);
set(pie(2),'facecolor',[255 0 0]./255);
  2 comentarios
voxynn
voxynn el 25 de Sept. de 2020
Thank you! Not entirely sure why though...
Ameer Hamza
Ameer Hamza el 25 de Sept. de 2020
I am glad to be of help!
The first input to set() is the handle of the graphic object you are trying to modify. You already have handles to patches. You don't need anything else.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by