how to string a data from uitable that been input by the user?

1.1k views Asked by At
  1. I'm trying to build a matrix form by creating a uitable in GUIDE. So I want the user to enter data into the table and I want to use the data at the pushbutton. But I dunno how to string the data from the table to the pushbutton. Is there any way to program the table? Im just take callback only. Do I have to take the create function, cellselectionfunc and etc in my m-editor?

  2. I want to make a 3 by 3 matrix, but I cannot edit the row at property inspection. When I delete the 4th row and I apply, its always has 4 rows. I just want to make 3 by 3 matrix. Not 4 by 3.

1

There are 1 answers

0
grantnz On BEST ANSWER

Assuming the tag property on your uitable is MyTable the following code will get the data from the table.

data = get(handles.MyTable,'Data');

If you put this code into your button callback (assuming your button has a tag of MyButton this will be function MyButton_Callback(hObject, eventdata, handles)) you should be able to see the table data when the button is clicked.

You can initialise the table data in the figures 'OpeningFcn' (which should have been created by Guide) to a 3x3 cell matrix.

handles.output = hObject; 

% Initialise MyTable data to a 3x3 matrix
set(handles.MyTable,'Data', cell(3,3));   

% Update handles structure
guidata(hObject, handles);