when selecting two or more charts using popup menu like choosing 2 for 2 charts. how to create a code in script??

 채택된 답변

Image Analyst
Image Analyst 2016년 12월 24일

0 개 추천

Try this:
numCharts = 20;
% Prepare menu
for k = 1 : numCharts
choices{k} = {num2str(k)};
end
buttonNumber = menu('How many charts do you want?', choices)
rows = ceil(sqrt(buttonNumber));
cellContents = str2double(choices{buttonNumber})
for k = 1 : cellContents
% Make a plot
subplot(rows, rows, k);
% Put stuff in it.
data = 100*rand*rand(1,32);
bar(data, 'BarWidth', 1, 'EdgeColor', 'none');
grid on;
end

댓글 수: 4

ARYA NAYAK
ARYA NAYAK 2016년 12월 25일
it will create random multiple bar charts.
i want to create multiple bar charts using data passed by manual.
how to do the same
Image Analyst
Image Analyst 2016년 12월 25일
I don't know what you mean. Yes it creates multiple bar charts, as you can see. You say "i want to create multiple bar charts" so what's the problem? Do you not like that I used the bar() function to create each bar chart? What is your definition of "data passed by manual"? As you can see, I passed data into bar(). If that's not manual (maybe you consider it automatic???) then exactly what do you consider to be manual?
ARYA NAYAK
ARYA NAYAK 2016년 12월 25일
i mean to say
for two bar charts data passed manual like this 4 textboxes and one push button. first 2 textboxes for one bar chart value inputting. then other 2 textboxes another bar chart. textbox1 assume as w values textbox2 as x values textbox3 as y vales. textbox4 as z vales. then push button call back does following function
bar(w,x); and bar(y,z);
i want to plot these 2 bar charts in single axes. (grouped bar charts).
Image Analyst
Image Analyst 2016년 12월 26일
Take a look at the histogram() function. You can pass in x and count data and it will plot them. Call hold on and call histogram again if you want multiple bar series. Or maybe it can do it all in one call - I'd have to read the help carefully.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

2016년 12월 24일

댓글:

2016년 12월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by