What is the difference between xlsfinfo and xlsread?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lexington Stoyell
el 7 de Feb. de 2018
Comentada: Walter Roberson
el 7 de Feb. de 2018
I currently have a code where the file is read in using xlsfinfo. Below I have attached a code that requires xlsread (I think anyway...it does not work when I use xlsfinfo and error codes "Expected to be a cell array, was char instead."). I am unsure whether functions within the rest of the code need specific information from xlsfinfo, or it xlsread would work just fine. If so I do not want to have to read in the file twice using the two file readers. Also I am new to xlsfinfo and would like an explanation of it and the difference between it and xlsread. Thank you!
[~,~,dat]=xlsread('Practice_AFT.xlsx');
%Finds the row and column where the word is...
[~,headerCol_Command] = find(cellfun(@(x)~isempty(strfind(x,'Command')),dat));
dat1=dat(:,headerCol_Command);%extracts the column for Command
0 comentarios
Respuesta aceptada
Steven Lord
el 7 de Feb. de 2018
The xlsfinfo function returns some information about the spreadsheet whose name you specified as the input.
To use an analogy, xlsfinfo tells you what cereal is in the box you're holding while xlsread pours you a bowl of that cereal. If you already know what cereal is in the box and you just want to eat, use xlsread. If it's dark in the kitchen and you want to make sure before you pour that you're holding a box of cereal not a box of dishwasher detergent, you should use xlsinfo first.
3 comentarios
Walter Roberson
el 7 de Feb. de 2018
xlsinfo() is often not needed, as it is common to already know the sheet names, and good practice on xlsread() would be to use a try/catch block just in case reading the file failed anyhow. xlsinfo() can be slow, especially on xlsx files on OS-X or Linux.
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!