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.

Create a Simple Class – MATLAB & Simulink

The basic purpose of a class is to define an object that encapsulates data and the operations performed on that data.

GNU Octave: Creating a Class

GNU Octave: Creating a Class

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