OK, I called tech support and they were able to replicate the problem once. But that was enough to show them that there was a problem. The work around to resolve the issue was to do a 'clear all' on the Matlab main window before I run the app.
Newbie Table Array and UITable question
1 次查看(过去 30 天)
显示 更早的评论
The GUI was made using App Designer. The following code, I create and initialize the property InstrumentTable at the same time and then set app.UITable.Data = app.InstrumentTable and got InstrumentaTable to show in the GUI. This is what I wanted.
properties (Access = private)
InstrumentTable = table("test", "HP1", 0, 0)
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
%app.InstrumentTable = table("test", "HP1", 0, 0)
app.UITable.Data = app.InstrumentTable
end
end
However, when I initialize InstrumentTable in the startupFcn of the app I just get a blank table: Here is the code
properties (Access = private)
InstrumentTable
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.InstrumentTable = table("test", "HP1", 0, 0)
app.UITable.Data = app.InstrumentTable
end
end
Here is the result
Can someone explain to this newbie what is going on?
回答(2 个)
Bhargavi Maganuru
2019-9-11
properties (Access = private)
InstrumentTable
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.InstrumentTable = table("test", "HP1", 0, 0)
app.UITable.Data = app.InstrumentTable
end
end
This code is working fine, and output is getting as expected (table values are displayed).
In properties section, you can create custom properties for data that is shared between different parts of app and it doesn’t matter where you initialize the property.
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!