help with pie chart

2 ビュー (過去 30 日間)
lisa davis
lisa davis 2021 年 4 月 9 日
編集済み: KALYAN ACHARJYA 2021 年 4 月 9 日
I need help with a pie chart graph.
the user input numbers of his choise, and then if the sum is less than 100, the remainder should present 'other', while all the other input stays with %.
thanks

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 4 月 9 日
編集済み: KALYAN ACHARJYA 2021 年 4 月 9 日
Suficients Hints: Enter the levels by yourself.
counts=input('Enter the Total Cetegory');
p=[];
i=1;
while i<=counts
p(i)=input('Enter the % Category: ');
i=i+1;
end
if sum(p)>100
disp('Invalid Entry: Sum Greater than 100');
elseif sum(p)==100
%Plot pie p
else
other=100-sum(p);
p=[p,other]
...%Plot P
end

カテゴリ

Help Center および File ExchangePie Charts についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by