Name variable after today's date / Variable nach aktuellem Datum benennen
1 次查看(过去 30 天)
显示 更早的评论
Guten Tag!
Ich möchte eine Variable nach dem aktuellen Tag benennen.
Die Variable sollte dann wie folgt benannt werden:
'heutigesDatum'_Aufträge
Wenn ich die unten angeführten Codezeilen ausführe, bekomme ich für x für den heutigen Tag '211010' --> Also soll die Variable 211010_Auftäge benannt haben.
Wie kann man das machen?
Danke für Ihre Hilfe!
__________________________________
Hello,
I would like to name a variable after the current day.
The variable should then be named as follows:
'today'sDate'_Aufträge.
When I run the lines of code below, I get '211010' for x for today's day --> So the variable should have named 211010_Aufträge.
How can this be done?
Thanks for your help!
formatOut = 'yyyymmdd'
x=datestr(now,formatOut)
0 个评论
采纳的回答
Harald
2023-7-7
Hi,
a variable name needs to start with a letter and must noch contain "special" characters such as German umlauts. It would only be possible to generate a name such as Auftraege_211010.
However, I would not recommend this at all. While you can achieve this naming using eval, you will have to continue working with eval in every single line that should automatically process this variable. If you need to store this information in the variable, a struct will be a better choice.
Best wishes,
Harald
0 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!