I need to make a function that reads an excel file?

조회 수: 1 (최근 30일)
studentdavid
studentdavid 2016년 6월 7일
댓글: studentdavid 2016년 6월 7일
How do I read an Excel file into a function without hard coding it? I want to be able to put the file into the functionhandle with a predefined variable as the xlsx file, but i can't seem to make it work.
  댓글 수: 1
Guillaume
Guillaume 2016년 6월 7일
Can explain more clearly what you're trying to do. An example of inputs and expected outputs would be useful.
" I want to be able to put the file into the functionhandle with a predefined variable as the xlsx file". Does not make any sense to me. What function handle?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2016년 6월 7일
How about this
function [numbers, strings, raw] = MyXlsread(filename)
numbers = [];
strings = [];
raw = [];
if exist(filename, 'file')
[numbers, strings, raw] = xlsread(filename);
else
message = sprintf('File not found:\n%s', filename);
uiwait(warndlg(message));
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by