Error importing excel table into app designer table
이전 댓글 표시
Hi,
I am a beginner to MATLAB and making an application using App Designer. I have been working and haven't been able to find an answer online, but I am trying to get a button in my app so that; when the button is clicked, I can choose a excel(csv) file to display onto the UI table once chosen.
However, I am receiving the following error; Error setting property 'Data' of class 'Table': Values within a cell array must be numeric, logical, or char
Is there a problem with my code or is this an issue with my data set? My data set contains a mixture of integers, strings, date and time.
Below is my code for the callback on the button;
[filename, pathname] = uigetfile({'*.csv'},'File Selector');
fullpath = strcat(pathname,filename);
x = readtable(fullpath);
app.UITable.Data = table2cell(x);
Many Thanks for your help
댓글 수: 4
Kojiro Saito
2018년 10월 2일
I couldn't reproduce this with my CSV data. Could you provide your sample (extracted) CSV?
Tamim Hussain
2018년 10월 2일
Kojiro Saito
2018년 10월 3일
Is it possible to provide your sample data? Because I've created a dummy csv file as the attached and it works without an error with your above codes. I think it's difficult to investigate why the error occurs without your sample data.
Tamim Hussain
2018년 10월 3일
편집: Tamim Hussain
2018년 10월 3일
채택된 답변
추가 답변 (1개)
sarthak rawat
2018년 12월 21일
0 개 추천
error:"Struct contents reference from a non-struct array object."
comes in line "app.UITable.ColumnName = x.Properties.VariableNames"
please help!!
댓글 수: 2
Kojiro Saito
2018년 12월 25일
Could you give more detail information (codes or mlapp and csv data) to investigate why the error occurs, please?
Rubén García García
2020년 4월 18일
function seleccionararchivoButtonPushed(app, event)
global archivo
[ filname, pathname ] = uigetfile({'*.xlsx'},'File Selector');
fullpathname = strcat(pathname,filname);
archivo = xlsread(fullpathname);
app.Label.Text = filname;
app.UITable.ColumnName = [{'Gb','Ta','Ta','Ts','Flujo'}];
app.UITable.Data = array2table(archivo);
카테고리
도움말 센터 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
