필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Gathering excel files over months

조회 수: 1 (최근 30일)
Ellis Berry
Ellis Berry 2016년 8월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi everybody,
So as my GUI produces excel files I use xlxwrite to save the function to my computer. Is there any way to save the excel files in folders called 'Month/Year' of whatever the current month and year is? I want Matlab to search for the current month (August) and if the folder doesn't exist, create one called 'August 2016'. In this it will save an excel file with the sheet of results called 'time'. This will be the time at which the file was saved. Each time the file is run in that month I want it to ADD TO THE SAME WORKBOOK but as a new sheet. So the tabs on the bottom will all be the different days and times the test was done?
As you can guess, once the next month arrives (September), if someone was to run the script Matlab would know to make a September folder?
Any ideas?
Many Thanks,
Ellis

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 2일
편집: Azzi Abdelmalek 2016년 8월 2일
d=now
[~,m]=month(d)
y=year(d)
if ~isdir(m) % Test if the foldr exist
f=[ m num2str(y)]
mkdir(f) % Create a new folder aug2016
You can name your file:
filename=datestr(d,'dd_HH:MM:SS.xlsx') % dd is the day
end

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by