polarplot app.panel with condition in app designer
Show older comments
Hi everyone,
I currently need a way to do a polarplot in app designer with some conditions. I tried a normal polatplot in a panel and it worked but when I tried doing it with if statements it only showed up with one dot.
I have tested it in a script and it worked.
So only the for loop and the if statements do not work in app designer at the moment.
Does anyone know how to get around it or fix it?
would be much appreciated with any help.
I put this code under a button callback.


y1 = [1,2,3,4,5,6,7,8,9,10,14,13,12,11,1,1,1,1,1,1,1,1,1,1] %for example
dotsize = 30;
n = 7; %no. of turns
theta1 = linspace(0,n*2*pi,length(y1));
rho1 = linspace(1,2,numel(theta1));
pax = polaraxes(app.Panel);
for i = 1:length(y1)
for ii = y1(i)
if ii < 3 % if score is below 3, colour red
polarplot(theta1(i),rho1(i),'r.','Markersize',dotsize);
hold on
elseif 3 <= ii && ii < 8 % if score is between 3 and 8 clour green
polarplot(theta1(i),rho1(i),'g.','Markersize',dotsize);
hold on
elseif 8 <= ii && ii <= 14 % if score is greater than 8, colour blue
polarplot(theta1(i),rho1(i),'b.','Markersize',dotsize);
hold on
end
end
end
pax.ThetaDir = 'clockwise';
pax.FontSize = 12;
pax.ThetaZeroLocation = 'top';
thetaticks(pax,[0 30 60 90 120 150 180 210 240 270 300 330])
thetaticklabels(pax,{'00:00','02:00','04:00','06:00','08:00','10:00','12:00',...
'14:00','16:00','18:00','20:00','22:00'})
rticks(pax,[])
1 Comment
Man Lok Lee
on 23 Aug 2021
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!