Name variable after today's date / Variable nach aktuellem Datum benennen
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Harald
on 7 Jul 2023
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 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!