how to pass data to a Table in GUI?

4 次查看(过去 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