Changing A Field Name
Mostrar comentarios más antiguos
Hi, I have a lot of files that are named based on their date (ex: 20140702.csv is July 2 2014). I need to save the data in these files under one structure called r. So I would like to have it called r.file_20140702. How do I change the fieldname from '20140702' to 'file_20140702'? Matlab won't accept 'r.20140702'.
Respuestas (1)
Star Strider
el 19 de Nov. de 2014
Here’s one way:
filename = '20140702.csv';
fildate = filename(1:strfind(filename,'.csv')-1);
fieldname = ['file_' fildate];
2 comentarios
Stacey
el 19 de Nov. de 2014
Star Strider
el 19 de Nov. de 2014
I don’t understand, since it doesn’t seem to be what you asked in your Question, but if it works, go with it.
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!