필터 지우기
필터 지우기

How can I export text and numeric data from excel to uitable (GUI element)

조회 수: 1 (최근 30일)
Gabriel Aviles
Gabriel Aviles 2020년 5월 20일
답변: Tommy 2020년 5월 21일
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)

답변 (1개)

Tommy
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).
Does converting to a cell array with table2cell fix your problem?

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by