I am trying to access PI data from Matlab. I used the white papers in the library and I am able to connect and retrive data using the demo functions.
However, when I try to retrieve a large amount of information, for exemple, a few months of data for a point stored every 2 minutes, it crashes in the
r = invoke(cn,'Execute',sql);
sclSuccess = 1;
sclSuccess = 0;
%retrieve data from recordset
It crashes at r = invoke(cn,'Execute',sql);
Here is the matlab output :
??? Undefined function or variable "r".
Error in ==> adodbquery at 40
Error in ==> PI_CompressedData at 31
Error in ==> PI_Demo at 36
Note : I understand that this error is normal since r is undefined in the case our query crashes and is never assigned a value, but I kept the original file for this example
The query is allright. When I enter it in the PIOLEDB.msc application, it works. I cannot see all the data since the grid seems limited, but at least the query runs.
In my case it is :
select tag,time,value from piarchive..picomp2 where tag = 'im.cim.g01:mw' AND time between '2010-01-01' and '2011-01-01'
Was anyone able to retrive that kind of amount of data ? I did some test and was able to retrieve many months ( more than 130k rows ), but a full year does not work.
I was thinking about retrieving more than a decade of data and I can't even get past a year and I would rather loop the process of querying the database. This should work directly.
Also, I don't know if people experimented problems, but it seems the connections does not clear or close itself quite allright. I sometimes have to restart my Matlab application and now the query works. ( But never in the case of "big" queries )
Thanks for your help!