I don't really understand the equation above. I'm guessing y is an array (maybe a vector?) of 3 and you are setting it to those three elements of the array X? If that's the case then you'd need to do something like:
1 2 3
y = x;
y = x;
y = x;
Remember MATLAB m files are much higher level than C++. That means that many more things are done for you. Here, we are much closer to the processor and need to tell it every specific instruction.
You COULD make a class that would do something like this. But you'd have to define overloading functions and the syntax wouldn't be the same. It would be something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
double* operator (int size, ...)
double* y = newdouble[size];
for (int i = 0; i < size; ++i)
y[i]=X[ va_arg(vl,int) ];
This will create an array with those elements in it,. used like so:
1 2 3 4
// X gets populated somehow
y = X[3, 1, 3, 5];
The first argument represents the size of y. The rest of the arguments represent the indices of X that are being sent to y.
Note that if you don't use the delete keyword here, you'll have memory leaks.
"I don't really understand the equation above. I'm guessing y is an array (maybe a vector?) of 3 and you are setting it to those three elements of the array X?"
Thanks for the help on what I'll need to do. I guess I need to get used to taking care of these kind of details, at least in making a class that does it which is a nice suggestion. Once I learn how to do classes :)