How to plot pie chart in Matlab GUI using buttons?

Hi again,
I have 3 buttons named "Weekone", "Month" "Year" - I want to plot 3 pie charts using axes when the buttons are pressed.
Here's my code below:
function weekone_Callback(hObject, eventdata, handles)
X = categorical ({'Present','Absence'});
explode = {'Absence'};
Labels = {'91%','9%'};
axes(handles.axes3);
pie(X,explode,labels);
I get the following error:
Unrecognized function or variable 'labels'.
Error in myprofile>weekone_Callback (line 281)
pie(X,explode,labels);

 Respuesta aceptada

Adam Danz
Adam Danz el 6 de Abr. de 2020

0 votos

Hint: "Labels" is not the same as "labels". Variable names are case sensitive.

3 comentarios

Miss B
Miss B el 6 de Abr. de 2020
Thank you so much!
Much appreciated :)
Quick question: Is there any way i can change the colours for the segmentation of the pie?
Adam Danz
Adam Danz el 6 de Abr. de 2020
Editada: Adam Danz el 6 de Abr. de 2020
Glad I could help. Since the pie chart color is a different topic, please create a new question and I'd be glad to answer that. It's a good question.
Miss B
Miss B el 6 de Abr. de 2020
Yeah sure!
Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 6 de Abr. de 2020

Editada:

el 6 de Abr. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by