How to manually edit the uitable in a MATLAB GUI?

1 view (last 30 days)
I am in the process of editing a UITable as part of a GUI setup in MATLAB. Can someone please help me write the code for the following below?
THANK you!
I currently have;
1) edit text box -to input text in the form of a number 2) uitable - to create matrix
Based off of what the user will input in the edit text box, say '5'. In this case I want to take that number and create populate a matrix (uitable) off of that number to be a 5 by 5 matrix.
I know to;
get(handles.editbox, 'String') - in this case convert the str2num to be used by the matrix.
But once the "uitable" is summoned by clicking apply next to the edit text box, what is the code need to create the matrix columns and rows (5 by 5)

Accepted Answer

Orion
Orion on 7 Oct 2014
Edited: Orion on 7 Oct 2014
Hi,
Once the edit is filled and you click on apply, you need to use the handle of your uitable, let say utable, and specify the data parameter with the nxn matrix you want to display.
something like :
SizeMat = str2num(get(handles.editbox,'String')); % get the size of the matrix
Matrix = magic(SizeMat); % create a matrix with the size defined in the edit field
set(handles.utable,'Data',Matrix); % put the matrix in the uitable

More Answers (1)

Vinesh
Vinesh on 7 Oct 2014
- Hi
I want examples for DSP F28335 with CCSTUDIOV5.3

Categories

Find more on MATLAB 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!