Editing newly added columns in existing uitable.

4 views (last 30 days)
I would like to ask this:I have created a uitable(size 1x8) in GUIDE and have added the following code in the opening function:
someData={'EU','US','OT','EE','CA','IA','AF','LA'};
set(handles.uitable2,'Data',someData)
I wanted to be able to add columns to this table with a push button and have written it this way:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data = get(handles.uitable2,'Data');
newColumn={''};
newData=[data,newColumn];
set(handles.uitable2,'Data',newData)
My problem is that when i push the button,a new column does appear,but i can't edit or write in it.How can i do that? (I want to be able to write strings,not numbers in it too).
Also I would like to ask how I can create a new uitable whose row names will be the names of the existing uitable i just created,and if this can change dynamically,according to how many columns I have added to my first uitable.
I realize this might be kind of a difficult question,but any answers would be greatly appreciated. Thanks

Accepted Answer

TUC
TUC on 5 Dec 2013
Nevermind,found the answer to my second question too.

More Answers (1)

TUC
TUC on 4 Dec 2013
Actually I just found the answer to my first question,I only had to go to property inspector of my uitable and add more columns,and tick on the editable box.So now only my second question remains:
How to create a new uitable whose row names(or column names) will be the data that i have inserted in my first uitable(US,EU,OT,etc) and if i can change it dynamically,according to how many columns i have added to my first uitable.

Categories

Find more on Migrate GUIDE Apps 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!