Tuesday, March 16, 2010

How to parse the file name and rename in Matlab

Programmer Question

I am reading a .xls file and then procesing it inside and rewriting it in the end of my program. I was wondering if someone can help me to parse the dates
as my input file name is like file_1_2010_03_03.csv



and i want my outputfile to be



newfile_2010_03_03.xls



is there a way to incorporate in matlab program so i do not have to manually write the command

xlswrite('newfile_2010_03_03.xls', M);
everytime and change the dates as i input files with diff dates

like
file_2_2010_03_04.csv.



Maybe i was not clear>
I am using uigetfile to input 3 diff files in format
file_1_2010_03_03.csv,file_2_2010_03_03.csv,file_3_2010_03_03.csv



Now i am processing the file inside my program and writing 4 output files
with names newfileX_3_2010_03_03.xls,newfileXY_3_2010_03_03.xls,newfileXZ_3_2010_03_03.xls,
newfileYZ_3_2010_03_03.xls



so my dates are not current date , but i need that from the input file and append that to newname for my xlswrite.



so was wondering if there is a way i can write a generic



xlswrite ('xxx ' M);
which will pick the name i want instead of me having 2 modify the name' xxx' everytime i input a new file



Thanks



Thanks



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails