how to pass data to a Table in GUI?

4 vues (au cours des 30 derniers jours)
AbuYusuf
AbuYusuf le 20 Juil 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

Réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by