Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

reading .xlsx files and saving as .mat files

Asked by John on 15 Dec 2011

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

0 Comments

John

Tags

Products

No products are associated with this question.

1 Answer

Answer by RNTL on 10 Feb 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.

0 Comments

RNTL

Contact us