Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In need of a good MATLAB class tutorial [closed]

Tags:

oop

matlab

I'm having a lot of trouble trying to figure out how to use classes in MATLAB. I'm very familiar with C++ and Python but I just can't figure anything out about how to define classes in MATLAB. Does anyone know a very good resource with lots of examples? The official documentation leaves much to be desired.

like image 944
rlbond Avatar asked May 20 '10 23:05

rlbond


People also ask

What does class () do in MATLAB?

obj = class(s,ClassName) creates an array of objects of the specified class using the struct s as a pattern to determine the size of obj .

Can you make classes in MATLAB?

Creating classes can simplify programming tasks that involve specialized data structures or large numbers of functions that interact with special kinds of data. MATLAB classes support function and operator overloading, controlled access to properties and methods, reference and value semantics, and events and listeners.

Is OOP possible in MATLAB?

Using object-oriented programming in MATLAB, you can manage software complexity by organizing your code into logical components that are easier to maintain and extend.


2 Answers

Here is an example of a class implementation in Matlab (new style).
http://matlabmafia.wordpress.com/2010/11/27/enhanced-matlab-plotting-series-part-i/

Here is a selected paragraph:

Classes are used in a form of programming termed Object-Oriented Programming (OOP). But don’t shy away simply because you haven’t used them. We will walk through how the class is created to some extent. I was brought up in Mechanical Engineering (ME) and know that ME’s (and other engineering disciplines) are rarely exposed to object-oriented programming (as I usually get the blank stare when I bring it up around my ME colleagues). If you are interested, check out Matlab’s website about OOP @

http://www.mathworks.com/products/matlab/object_oriented_programming.html.

They do a nice job of providing an introduction and explaining the syntax.

like image 56
elee Avatar answered Sep 18 '22 09:09

elee


The mathwork site does have some OOP examples, could you indicate more precisely what you are looking for?

However, note that older Matlab versions had a different OOP syntax, the classdef keyword was added in 2008a (see video).

like image 44
catchmeifyoutry Avatar answered Sep 21 '22 09:09

catchmeifyoutry