1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: CS-Studio(Phoebus) Archive Viewer Matlab Export Issue |
From: | "Manoussakis, Adamandios via Tech-talk" <tech-talk at aps.anl.gov> |
To: | "Kasemir, Kay" <kasemirk at ornl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Mon, 1 Feb 2021 07:54:08 +0000 |
I have been working it on it a little bit more. I was able to find the function that was written for getting a double array out of value in vtypes/Vtypehelper.java public static double[] toDoubles(final VType value) { final double[] array; if (value instanceof VNumberArray) { final ListNumber list = ((VNumberArray) value).getData(); array = new double[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.getDouble(i); } } else array = new double[0]; return array; } I have a List<List<Double>> for values now to hold each waveform array. The issue I seem to be having is now with the jmatio part. Each struct has a MLDouble Value which I pass it the dimensions (N,4000) so it should be for one of my cases N rows (timestamps) by 4000 pts for each waveform. final MLDouble value = new MLDouble(null, dims_values); However I cannot seem to figure out how to pass values(i) to value to set it in the struct I thought MLDouble could just take an array from the API I read. So each row index would get an array assigned to it but value.set is expecting a Double and does not accept the array. value.set(values.get(i),i); I also have tried just constructing the MLDouble with the matrix of values but also no luck.
final MLDouble value = new MLDouble(null, dims_values); From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of
Manoussakis, Adamandios via Tech-talk Hi Kay, I have been looking through the src and I am a little confused on how to actually get the exported array data out. I see you have this iterator here to cycle through each value for each timestamp final VType value = iter.next(); then you turn that VType into a double using values.add(VTypeHelper.toDouble(value)); Does iter return the start of each array index if it’s an array of values or is it only returning the first index? If Value is a VNumberArray is there a way to add it to the values list if I make it a List of Arrays instead of a List of Doubles? Thanks From: Kasemir, Kay <kasemirk at ornl.gov>
> spreadsheet data shows up just fine.. > matlab files seem to be exporting just a single index per record Yes, the Matlab export code only handles scalars. In case of array data, you get the first element. The code in question is this for the Matlab 'text file' *.m export and this for the Matlab 'binary' *.mat export In both places you'll see that it calls VTypeHelper.toDouble to try and turn the sample which might be double, enum, int, short, ... into a scalar for export. You could try to update that code to check for VNumberArray and then export all array elements. -Kay |