MATLAB: Set facecolor in app designer

app designer

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?
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);
axis(app.UIAxes, 'equal');
box(app.UIAxes, 'off');
set(app.UIAxes,pie(1),'facecolor',[255 85 180]./255);
set(app.UIAxes,pie(2),'facecolor',[255 0 0]./255);

Best Answer

  • 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);