Yes, but you have to "roll your own", so to speak. (You should note that even the sort of optional arguments you see in various core LaTeX macros, like the ones which take two optionals, are not supported by the \newcommand
syntax).
The basic mechanism is to use \@ifnextchar
to figure out whether there is an optional argument, filling it in if not, and then calling an internal macro which doesn't take an optional argument. In your case the following seems reasonable (note: written on the fly):
\makeatletter
\newcommand{\codefrom}[1]{
\@ifnextchar[
{\codefrom@firstinner{#1}}
{\codefrom@firstinner{#1}[#1]}
}
\def\codefrom@firstinner#1[#2]{
\@ifnextchar[
{\codefrom@secondinner{#1}{#2}}
{\codefrom@secondinner{#1}{#2}[Matlab]}
}
\def\codefrom@secondinner#1#2[#3]{
...
}
\makeatother
As you can see, at each step it checks for a [
and, if it is not present, fills in the argument with the desired default. The last step has all the arguments, and continues the process.