how to pass data to a Table in GUI?

1 view (last 30 days)
AbuYusuf
AbuYusuf on 20 Jul 2017
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

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!