So I have a class called agent with these following properties:
classdef agent < handle
properties
x
v
goal
v_pref
end
Here, x and v are 1-by-2 vectors. Let's suppose that I have an n-by-1 object array where each part of the array contains instances of the class called agent. Currently, I am having trouble overwriting the assignment behavior of my code. Whenever I am doing something like this:
obj.x([1;3], 1) = [ 5; 3];
I want to overwrite object 1 and 3s 1st element of x with 5 and 3, respectively.
So essentially I want these commands to be equivalent as above
obj(1).x(1) = 5;
obj(3).x(1) = 3;
Is there a way to do this in matlab using subsasgn or any other overloading function.