How to convert day information to a number?

2 views (last 30 days)
How can I convert day information to a number?
For instance, Mon to 1, Tue to 2, etc.
Fo from character to number data.

Accepted Answer

Star Strider
Star Strider on 24 Sep 2021
Experiment with something like this —
daynr = @(x) find(strcmp(x, {'Mon','Tue','Wed','Thu','Fri','Sat','sun'}));
nr = daynr('Thu')
nr = 4
Everything depends on the context it will be used in, so this is just an example of one approach.
.
  2 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!