How can I export text and numeric data from excel to uitable (GUI element)
2 次查看(过去 30 天)
显示 更早的评论
Hello.I made a simple GUI where I want to be able to display text-numeric data using uitable. I tried using readtable but the outcome is an error.
%Error Message
Error using matlab.ui.control.Table/set
Functionality not supported with figures created with the figure function. For more information, see Graphics
Support in App Designer.
%Part of the code with Data
% --- Executes just before untitled is made visible.
function untitled_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled (see VARARGIN)
% Choose default command line output for untitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
x = readtable('Informacion_Psicologica1.xlsx')
set(handles.uitable3, 'Data',x)
0 个评论
回答(1 个)
Tommy
2020-5-21
According to the docs, when you set the Data property of a uitable created with the figure function, you must set it to a numeric array, logical array, or cell array.
The Data property of a uitable created with the uifigure function, on the other hand, can be set to a table, which is what you are trying to do (as readtable returns a table).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!