Object-oriented Scripting in Octave and Matlab

I am facing a problem of implementing a board game. In this, a smart agent is expected to raise havoc on the board while exploring it. I was thinking that if the agent was implemented as an object, it would make life a lot easier from the point of view of implementing the game.

Both Matlab and Octave allow object-oriented scripting. An object can have its own fields and methods. The way it can be accomplished is slightly different for each of these languages. In Matlab, you can create a class and define its methods in the same file that you used to create the class. In Octave, you have to create a folder for a class. You put all the methods for that class in that folder as m-files.

Creating a Simple Class – MATLAB & Simulink

This simple class introduces the basic patterns and syntax for defining a class.

Creating a Class (GNU Octave (version 8.4.0))

Creating a Class (GNU Octave (version 8.4.0))

Photo by sapphirebluebird

If you found an error, highlight it and press Shift + Enter or click here to inform us.

CC BY-NC-ND 4.0 Object-oriented Scripting in Octave and Matlab by Psyops Prime is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Leave a Reply