0

Somewhere between R2010b and R2018a, Matlab seems to have removed dos as a built-in function.

In R2010b:

>> which dos
built-in (C:\Program Files\MATLAB\R2010b\toolbox\matlab\general\dos)

In R2018a:

>> which dos
C:\Program Files\MATLAB\R2018a\toolbox\matlab\general\dos.m

Why, and when, was this change made?

Jeff V
  • 571
  • 1
  • 5
  • 17
  • 1
    This is something only The MathWorks can answer, not random people on the internet. My hunch is that, since it still exists, the name "built-in" was used for everything that came with MATLAB, whilst nowadays it's only used for stuff written in another language and compiled and shipped along (see [this answer of mine](https://stackoverflow.com/a/50832559/5211833)) – Adriaan Aug 20 '18 at 18:20
  • In R2010b type `edit dos`. I think you will see the same M-file function as you see if you do that in R2018a. If so, then nothing changed. – Cris Luengo Aug 20 '18 at 18:28
  • The 2018a version of `dos.m` does contain a call out to `system()`, but the 2010b version is just help documentation (no code). – Jeff V Aug 20 '18 at 18:39
  • 1
    Then indeed it has been converted from a built-in function to M-file code. There is no way we can know about the reasons. The M-file code should contain a copyright statement, you might be able to see when they wrote that code. :) – Cris Luengo Aug 20 '18 at 18:42
  • Ah! The copyright is from 2016, so the change must have happened somewhere between 2010 and 2016. – Jeff V Aug 20 '18 at 18:44

1 Answers1

0

If you open the file dos.m you can notice that is a wrapper to the built-in function system so the answar might be that MathWorks has improved the system function to run correctly both Windows command and Unix command so a built-in function for a wrapper is useless due the definition of built-in function:

A built-in function is part of the MATLAB executable. MATLAB does not implement these functions in the MATLAB language. Although most built-in functions have a .m file associated with them, this file only supplies documentation for the function.

Andrea Bellizzi
  • 497
  • 5
  • 14
  • In 2010b, the documentation declares that `dos()` is interchangeable with `system()` (in Windows). It seems like they removed `dos()` as its own code path, and have changed it to be an m-file that calls out to `system()`. But I'm wondering why they would have made this change, as calls to `builtin('dos',…` fail in 2018a. – Jeff V Aug 20 '18 at 18:42
  • @JeffV if dos and system are interchangeable since 2010b it is more right the choice of remove it as built-in function. Maybe they did some statistic of use of built-in function and they saw that most of time users call system, so they had removed dos as built-in function and had made a wrapper to system for portability – Andrea Bellizzi Aug 20 '18 at 19:15