08-28-2013 06:48 AM
I have comma delimited string in this format
[0.866405665874481,0.127425819635391,0.983153462409973,-0.0711551383137703,0.955700755119324,-0.27884304523468,0.787182509899139,-0.501964211463928,0.512355387210846,-0.687117278575897,0.177220240235329,-0.777789652347565,-0.0876994803547859,-0.792799115180969,-0.324512422084808,-0.736825287342072,-0.517065346240997,-0.627932071685791,-0.666604995727539,-0.471743047237396,-0.767350137233734,-0.287838608026505,-0.819185018539429,-0.0853987112641335,-0.81872695684433,0.123056441545486,-0.761552691459656]
The data contains pairs of complex numbers. The first 2 numbers is one pair, next 2 numbers one pair, next pairs.....
How can I extract the pairs of number and make it into a 1D complex array?
This is the expected output:
(0.866405665874481,0.127425819635391),(0.983153462409973,-0.0711551383137703),(0.955700755119324,-0.27884304523468),(0.787182509899139,-0.501964211463928),(0.512355387210846,-0.687117278575897),(0.177220240235329,-0.777789652347565),(-0.0876994803547859,-0.792799115180969),(-0.324512422084808,-0.736825287342072),(-0.517065346240997,-0.627932071685791),(-0.666604995727539,-0.471743047237396),(-0.767350137233734,-0.287838608026505),(-0.819185018539429,-0.0853987112641335),(-0.81872695684433),(0.123056441545486,-0.761552691459656)
Any gurus pls advise
Solved! Go to Solution.
08-28-2013 07:00 AM
I would use Match Regular Expression to parse the input string. Regular expression (\d+.\d+),(\d+.\d+) gives two submatches, which can be converted to numbers. Then you can loop through remaining string to get the next pair.
08-28-2013 07:06 AM - edited 08-28-2013 07:07 AM
I used the Spreadsheet String to Array, Decimate Array, and then Re/Im to Complex.
