
Re: How to get values from PIPoint.Summaries in Matlab
tramachandran Jul 12, 2018 11:32 PM (in response to Jiaqi)1 of 1 people found this helpfulIn Python I was able to retrieve the summaries(Average)
Could you try
for s in summarizedVals: #should be just Average summary type as specified vals = s.Value for v in vals: print ("{}".format(v.Value))
The values you are looking for are v.Value and you can put them into a Matlab array.
Also I had to modify the AFTimespan constructor to have 0,0,0,1.0 (int,int,int,double)

Re: How to get values from PIPoint.Summaries in Matlab
Jiaqi Jul 13, 2018 11:17 AM (in response to tramachandran)Thyagarajan,
Thanks. With the Item method, I can retrieve AFValues now.
AFSumTypes = bitor(AFSummaryTypes.Average, AFSummaryTypes.Minimum);
AFSumTypes = bitor(AFSumTypes, AFSummaryTypes.Maximum);
summarizedVals = point.Summaries(timerg, inter, AFSumTypes,...
AFCalculationBasis.TimeWeighted, AFTimestampCalculation.Auto);
values = summarizedVals.Item(AFSummaryTypes.Average);
Following your explanation, I further wrote a function to retrieve multiple summaries.
Multiple AF values are stored in a structure. Maybe there are more efficient ways, but it works fine by far.
[AFVals, valKey] = GetKeyAFValues(summarizedVals);
function [AFVals, valKey] = GetKeyAFValues(DictionaryObj)
key_enum = DictionaryObj.GetEnumerator;
len = DictionaryObj.Keys.Count;
valKey = cell(1, len);
AFVals = struct;
cnt = 1;
stat = 1;
while stat
stat = key_enum.MoveNext;
if stat
key_val = key_enum.Current;
if ~isempty(key_val.Value)
valKey{1,cnt} = char(key_val.Key);
AFVals.(char(key_val.Key)) = key_val.Value;
cnt = cnt+1;
end
end
end
end

Re: How to get values from PIPoint.Summaries in Matlab
Marcos Vainer Loeff Jul 13, 2018 11:48 AM (in response to Jiaqi)1 of 1 people found this helpfulHello Jiaqi,
I guess the library below is more MATLAB friendly:
Announcing PI Web API client library for MATLAB Toolbox
Hope this helps!

Re: How to get values from PIPoint.Summaries in Matlab
Jiaqi Jul 13, 2018 12:02 PM (in response to Marcos Vainer Loeff)Many thanks, Marcos. I'll look at that.
Cheers
M


