MATLAB: How to create multiple bar chart? bar chart when selecting two or more charts using popup menu like choosing 2 for 2 charts. how to create a code in script?? Best Answer Try this:numCharts = 20;% Prepare menufor k = 1 : numCharts choices{k} = {num2str(k)};endbuttonNumber = 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 Related SolutionsMATLAB: How to write Continue Long Statements on Multiple Lines Use repmat to avoid manually typing all 160 of those ‘%q’ repeats! Try this: formatSpec = ['%f',repmat('%q',1,160), '%[^\n\r]']; MATLAB: How to print the value of a menu function? That is to say as follows: As I choose any option it saves the number,I want it to display the chosen option i.e option-1 draws bar. I am restricted to this function only Try it like this:menuOptions = {'bar','psi','kPa','torr','kgf/cm2','atm'}buttonNumber = menu('Choose the units :', menuOptions)EinUnits = menuOptions{buttonNumber} Related QuestionHow to change the width of bar chart?How do you get multiple lines in a GUIDear friends, the long matlab command that I have written is error. I want to be spelled the same way but without error.Menu function – would like menu to pop back up after choice madeMove to next selection
Best Answer