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)
댓글 수: 0
채택된 답변
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
댓글 수: 0
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!