Clear Filters
Clear Filters

Can the output of the weekday function be modified to return different numbers?

2 views (last 30 days)
Can the output of the weekday() function be modified like the excel weekday function so that Monday = 1 rather than Monday =2? I can always map it after the fact but it would be better if the function could just return the different number.

Accepted Answer

Rik
Rik on 16 Nov 2017
Depending on your release (and maybe even OS), you might be able to edit the internal Matlab function, but you shouldn't. It is best to modify your code to correct for the difference between what you need and what you get. (the mod function can help with the wrap-around)
Editing internal functions is a bad idea, because it removes any form of portability. If you choose to re-install Matlab, or install a newer release, you will have to re-apply the change, which might not be possible. You might also break other function (both internal function and function written by others (teachers/FEX submissions)).

More Answers (0)

Community Treasure Hunt

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

Start Hunting!