help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

operator overloading


From: Ali Akbar Eftekhari - CITG
Subject: operator overloading
Date: Wed, 2 Jan 2013 23:53:01 +0000

Dear all,

I like to use operator overloading to be able to add and subtract the
elements of two structures, which helps me to simplify my finite volume
tool for convection-diffusion problems.

A simple version of what I'm doing looks like this:

a.xvalue = 1:5;
b.xvalue = 2:6;
c = a+b;

In matlab, I have written a function like this:

function r = plus(p,q)
r.xvalue = p.xvalue + q.xvalue;

and saved it in a path: @struct/plus.m in my working directory and it
works without any problem. But in octave It does not work. Is it
possible to overload the operators for a struct class in octave?

Kind regards,

Ehsan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]