Pick a phrase to print depending on the time of day.
6 views (last 30 days)
Show older comments
I have a cell array which is the code below.
greetcell = {'Good morning', 'Good afternoon','Good evening'};
I need to pick one depends on the time of the day. Like if it is at night, it should be pick hte phrase : Good evening. However, I do not know what code should I put in for the time difference.
1 Comment
Geoff Hayes
on 17 Nov 2014
David - you will need to define the time periods that correspond to morning, day, and night. Whichever period the current timer falls into, 1 or 2 or 3, then that will tell you which message to retrieve (the first or second or third).
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!