Trying to Import Excel Data using GUIDE push button
조회 수: 13 (최근 30일)
이전 댓글 표시
I am trying to create a GUI that contains a Push Button that finds an excel file, and then extracts the data and creates a .m file of the Data so that in the future rows can be selected and analyzed using the GUIDE GUI. I am able to find the file with the Push Button but once the file is selected and Open is pressed a series of errors come up.
Here is what I have ...
function pushbutton1_Callback(hObject, eventdata, handles)
path = 'c:\users\userName\my documents\matlab';
filter = '*.csv';
selectedFile = uigetfile(fullfile(path , filter));
num = xlsread(filename);
댓글 수: 3
채택된 답변
Geoff Hayes
2016년 6월 8일
Tessa - use fullfile rather than strcat to create the full file name from the path and name. If you want to save the data from the Excel file to a mat file, then why not just do
save('myData.mat','raw');
which will save the data extracted from your Excel file into a mat file named myData.mat.
댓글 수: 16
Geoff Hayes
2016년 6월 10일
I can't help but wonder why the path to the file is not being prepended to the excelFullfilename. What is the pathname in
[filename pathname] = uigetfile({'.xlsx'},'File Selector');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!