How to change file extension to '.xlsx' BUT keep original files?
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to change files with extension '.stp' to '.xlsx' while also keeping the original '.stp' files. I have code that replaces the '.stp' files with '.xlsx', but it does not keep the originals:
files=dir('*.stp')
for i=1:length(files)
filename=files(i).name;
[pathstr, name, ext] = fileparts(filename);
movefile(filename, fullfile(pathstr, [name '.xlsx']))
end
Also, for some reason I am unable to open the resulting '.xlsx' files. However, when I write them to '.xls' they open with no problems. This is a problem because I need the files '.xlsx' format. If anyone knows how to solve this problem as well, it would be greatly appreciated.
I am running Matlab 2013a on a Mac.
0 个评论
采纳的回答
Image Analyst
2013-3-22
Use copyfile() instead of movefile().
3 个评论
Image Analyst
2013-3-22
You'd need to read the data in with some kind of .stp file reader, into variables in MATLAB. Then write out those variables with xlswrite().
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!