# Help me with tables and popup menu!!

8 views (last 30 days)
slumberk on 9 Feb 2011
I have a popup menu and a table. Popup menu is to select a generator that will be used by the user. For example if the user wants to use 2 generators, then the user may select '2 'on the popup menu. If the user select 2, then the table will be issued a 2 by 3 table. If users select three generators, then the table will be issued a 3 by 3 table. If users select four generators, then the table will be issued a 4 by 3 table and so on. My question is how i want this situation applies? What I mean is how to produce a 2 by 3 table when the user select '2' and 3 by 3 table when the user select '3' and so on?
For your info, My project is about economic dispatch. I have to build GUI using 4 generators and each of the generator have limit. So i have to make 2 uitables. So each generator user selected, then the user have to insert limit( in megawatt) for each generator(which is another table)
This is the example of my table(4 by 3):
Alpha Beta Gamma
C1
C2
C3
C4
The equation for the generator is :
C1 = (Alpha) + (Beta)P + (Gamma)P^2
C2 = (Alpha) + (Beta)P + (Gamma)P^2
C3 = (Alpha) + (Beta)P + (Gamma)P^2
C4 = (Alpha) + (Beta)P + (Gamma)P^2
This is a table for the limit of each generator:
Lower Upper
C1
C2
C3
C4
The form of this table will be :
Lower < C1 < Upper
Lower < C2 < Upper
Lower < C3 < Upper
Lower < C4 < Upper
So when the user select '2', then it will popup the 2 by 3 table. How i want to do it? What is the code for it and how i want to call the table data into the pushbuttons? Well i already make 2 uitable figures and i already set the table properties like the row name n column name. But how i want to make it only 2 row only?
Please do help me on this.

Arturo Moncada-Torres on 13 May 2011
In the popup menu callback, you should include something like this:
handles.output = hObject;
myData = zeros(noRows, 3);
set(handles.uitable1,'data',myData )
% Update handles structure
guidata(hObject, handles);
The new table will be filled with zeros and will have the dimensions specified by the user.
Hope it helps ;-) .