ABSTRACT

You are probably aware that MATLAB always passes function arguments by value. In a structured design, pass-by-value works well. In an object-oriented design, strict adherence to pass-by-value is at best inconvenient, and at worst it compromises the quality of a design. MATLAB doesn’t support pointers; however, under certain conditions, a trio of commands gives a good approximation to pass-by-reference. The three commands are inputname

,

evalin

, and assignin

. These commands are not limited to object-oriented programming, and the discussion in this chapter will help sort out some of the general pitfalls of using them both inside and outside an object-oriented implementation.