Guide: show a table data (readtable)
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello everyone,
I am creating a guide app that read a table that contain values and dates, as you can see here:

I used the command readtable to do so:
[nombre direc]=uigetfile('*.txt','Abrir datos');
DirDatos=fullfile(direc,nombre);
dataR=readtable(DirDatos);
Then, I have to present this information on a table in guide, for that I used:
set(handles.uitable1,'data',dataR)
However, an error said:
Error using matlab.ui.control.Table/set
Error setting property 'Data' of class 'Table':
Data must be a numeric, logical, string, cell, or table array
Error in Pruebagraficatabla>pushbutton1_Callback (line 94)
set(handles.uitable1,'data',vect2)
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in Pruebagraficatabla (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)Pruebagraficatabla('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
댓글 수: 0
답변 (1개)
Voss
2022년 1월 5일
Try one or both of these:
set(handles.uitable1,'data',table2array(dataR));
set(handles.uitable1,'data',table2cell(dataR));
댓글 수: 1
Walter Roberson
2022년 1월 5일
This is correct.
uitable() in traditional figures do not permit table() values. You need to be using uifigure() in order to support table() values.
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!