How to manually edit the uitable in a MATLAB GUI?

6 次查看(过去 30 天)
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)

采纳的回答

Orion
Orion 2014-10-7
编辑:Orion 2014-10-7
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

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by