필터 지우기
필터 지우기

View changing values in GUI

조회 수: 2 (최근 30일)
Simone Leon
Simone Leon 2011년 9월 27일
Presently I am trying to build a GUI. At the moment I have variables in the workspace in a 100 x 8 matrix. As I simulate the system these variables would change. They are not fixed.
I would like to use a table to view these variables. At present the uitable I have could only view the values but the values do not change when the system is simulated again. I would like the values to change every time the system is simulated.
How can I do this? There is the option to choose "Do not set data value and leave the table empty?"
But after I select this option I do not know what to do next from here.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 9월 27일
set(YourUiTableHandle, 'Data', num2cell(YourMatrix))
  댓글 수: 3
Simone Leon
Simone Leon 2011년 9월 28일
Should my CellEditCallback look like this?
% --- Executes when entered data in editable cell(s) in uitable4.
function uitable1_CellEditCallback(hObject, eventdata, handles)
set(YourUiTableHandle, 'Data', num2cell(YourMatrix))
Walter Roberson
Walter Roberson 2011년 9월 28일
'Data' is a literal string used as a keyword.
num2cell() is a MATLAB function.
YourMatrix is the matrix whose contents you want to put in to the UI Table.
YourUiTableHandle should be the handle of the uitable.
You would *not* put this in your CellEditCallback, because CellEditCallback is used when the user makes a change to the table, whereas what you want to just display the current values you have assigned. So each time you have new values to display, you would execute the above to change the display (if you are computing in a loop you may need to use a drawnow() call to get the GUI to update the screen.)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by