I have a c# system which has lots of time-series information. Each information is stored in the following data-structure :
public struct Tag
{
DateTime Time {get;set;}
double Value {get;set;}
}
We can actually consider these arrays of tags as Matlab vectors:
Array of Tags:
Time | Value
... | ...
... | ...
... | ...
Ok, so what I want is to provide the user with a very easy UI which he can write manipulations and expressions on these tags. The best way I came up with, is to let the user write Matlab expressions on these tags (This way the user is able to do almost anything with these vectors, he won't be needed to learn a new language, and the performance will be very fast - I forgot to mention, my Tag arrays are really big)
For example:
Let's say we have a tempratureTagArray and a windTagArray stored in the current run. (Each of these are arrays with minute-values between sunday and monday).
So I want the user to write something like:
x = windTagArray;
y = tempratureTagArray;
And then, a matlab expression :
if (x > y)
result = x.^y + y./7 * 12;
else
result = exp(x) + y.^6 - 7 + (x.*y).^3 + log(y);
end
I will take care for the part of defining the vectors (x and y) in my c# program and then I'll create a matlab .m file from this. What I need is an easy way to launch these .m files on matlab, and get the result vectors from these .m files in my c# runtime. This seems to me the easiest way to deal with such problem (I also wonder if this way is fast enough)
So, does anyone have a suggestion for implementing such operation?
I thought about launching a background Matlab program instance, and for every request, somehow "mock" user operations on the Matlab instance and then somehow read the results. But I am not sure its the best way for doing it. I wonder if maybe someone had to deal with such scenario.
Thanks a lot.
Edit: I would also be happy to hear your thoughts about runtime of such operations. This thing is going to run on a server with matlab which will get lots of such requests. I actually thought about Matlab because I know it works really fast when you use its native application (and it supports lots of math operations of course)