I need to make a function that reads an excel file?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
studentdavid
il 7 Giu 2016
Commentato: studentdavid
il 7 Giu 2016
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 Commento
Guillaume
il 7 Giu 2016
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?
Risposta accettata
Image Analyst
il 7 Giu 2016
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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Import from MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!