Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Rik
Rik le 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)).

Plus de réponses (0)

Catégories

En savoir plus sur Calendar dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by