MATLAB: How to add a table in GUI asking the user to input the number of rows.

guitableuser input

I am new to MATLAB. I am using GUIDE to create a GUI. I have an editable text box asking the user to input the number of rows. When the user types a number say 4, I would like a table to be created with 4 rows and two columns. Basically, I have the text box to input the degrees of freedom of a robot manipulator. And when the user inputs 4, I would like to ask what kind of a joint it is (Revolute or prismatic). So next time when the user inputs 5, I would like to define the type of each joint. So for some input n ( n can be anything from 1,2,3,…) I would like the user to define the type of each joint.

Best Answer

n = input('How many rows?');
newdata = cell(n,2);
set(handles.YourUitable, 'data', newdata);
Related Question