Borrar filtros
Borrar filtros

reading .xlsx files and saving as .mat files

1 visualización (últimos 30 días)
John
John el 15 de Dic. de 2011
Comentada: Alayt Abraham Issak el 18 de En. de 2019
Hello,
I'm trying to read in .xlsx files from the current folder and save them as .mat files to the same folder. However, the files are not being saved and I'm not sure why. Could somebody please advise me?
Also it would great if the .mat file names had the same names as the .xlsx files.
Thank you
This is the code I'm using:
files = dir('*xlsx.');
for k = 1:numel(files)
[num,text,raw]=xlsread(files(k).name);
save(files(k).name);
end
  1 comentario
Alayt Abraham Issak
Alayt Abraham Issak el 18 de En. de 2019
I am trying to do the same thing but Im a beginner.
Where do I type my excel file so I can get the same output?

Iniciar sesión para comentar.

Respuestas (1)

RNTL
RNTL el 10 de Feb. de 2012
try ... [num,text,raw] = xlsread(files(k).name) [dummy,myName] = fileparts(files(k).name); save(myName) end
so the file extension is removed prior saving. i think you're overwriting your excel file.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by