read multiple excel files in the one line of the code
Mostrar comentarios más antiguos
I have a set of folders which contains excel files. But the name of excel files differ from folder to folder but the content in them is same.Its like GAMMA in one folder and GA and GAM in another folder.All three files don't exist in the same folder. Can i give a command to read them in the same line if it exists in the folder which i want to read...
1 comentario
Yash
el 24 de Jul. de 2012
xlsread will read one excel file at a time
Respuestas (2)
Image Analyst
el 24 de Jul. de 2012
0 votos
No, not unless you put three xlsread()'s on the same line of code. Why does it need to be one line of code? What's wrong with 3 lines?
3 comentarios
vijay
el 24 de Jul. de 2012
Srinivas
el 24 de Jul. de 2012
may be you can use
try & catch
Image Analyst
el 24 de Jul. de 2012
Well you have to write robust code. Sorry about that. You'll need to construct your filename, then call exist(filename, 'file') to check that it actually exists before you call xlsread. Sorry, but robust, bulletproof code can't be written in a single line.
The only way is to use this instruction in a for loop
[num,txt,raw] = xlsread(fichierExcelTest,'Sheet1')
Categorías
Más información sobre Spreadsheets en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!