how to pass data to a Table in GUI?

조회 수: 2 (최근 30일)
AbuYusuf
AbuYusuf 2017년 7월 20일
I have a GUI with one input (x) and it returns one numeric output (Y) and matrix (Tab) in a table. The problem is the generated table in the GUI is not updated with every new input (x). Any hints what is the wrong in the code? Note that in the GUI I am defining a table with 5*5 (5 rows and 5 columns)
I used the following code:
x = str2double(get(handles.input1, 'String'));
[Y, Tab]= SyX(x);
set(handles.output1, 'String', Y);
set(handles.TabOutput, 'data', Tab);
function [Y, Tab]= SyX(x)
Y = x+2;
if x==1
Tab=[1 2 0 1]
elseif x==2
Tab = [1 0];
elseif x==3
Tab = [1 2;3 4];
else
Tab = [1 0 0;0 1 0; 0 0 1]
end

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by