Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

AGPNA SDATA Format

I am converting a AG 8720 read data vi to a AGPNA read data vi. The only way to get both phase and amplitude data is to read the complex number and convert it to polar. If I ask for SDATA the VISA read outputs the info in a string. I then do a spreadsheet to array (by the way this is all from the downloaded AGPNA from NI.com), but the data comes out as (for example):0.625 + 0 i

                      0.316 + 0 i

                     -0.167 + 0 i

                     -0.125 + 0 i

                      0.617 + 0 i

                      0.241 + 0 i

I believe what this should be outputting is: 0.625 + 0.316 i

                                                                 -0.167 - 0.125 i

                                                                  0.617 + 0.241 i

which is how I'd like it because then I assume I could just use the complex to polar conversion and I'd have my amplitude and phase data.

So what am I doing wrong?

 

0 Kudos
Message 1 of 3
(7,319 Views)
Aha!  I found the post!  Here's what I wrote in an email which you should receive shortly:
 
"Ok, I believe the Spreadsheet String to Array Function you are using might not be handling the complex numbers appropriately.  I am guessing that you are receiving a string such as "12.34 + 0.43i,12.34 + 0.43i,12.34 + 0.43i" and you would like an array with the corresponding complex values in it.  Well, attached is a VI which does precisely this for you!  You can change the characters to use as delimiters with a front panel control; the algorithm used is described in a comment on the front panel and block diagram, and the steps are indicated in the block diagram above the corresponding code.
 
I am not sure which board you posted to, so please post this VI on the forum in whichever board you posted; you can indicate that "JLS" sent you the VI 😉
 
If you are needing to do something else, please let me know and I'll do my best to guide you to a solution!"
 
The VI is attached here as well, just in case you check this first 🙂
 
Again, let me know if you need any further assistance!  We can correspond in this forum about this so that others can potentially benefit from and/or contribute to the stream!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 2 of 3
(7,306 Views)
Hello again,
 
I wanted to note that if you really care about program efficiency, instead of deleting the element from the array (which will likley cause a buffer allocation for the new array after the deletion), you can simply subtract one from the array size before looping to build the complex array; attached is an example of this, with values saved as default (the other one posted may not have had this... and it may not have been as clear since the delimiters weren't present 😞
 
Ok, I hope this helps!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 3 of 3
(7,298 Views)