LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array with Complex Numbers

So I've been able to recreate your result, but I still need to then export those values somehow in the complex form. I'm worried the process would be the same as what I tried originally where I would have to write the values to an array, which does not like complex values

0 Kudos
Message 11 of 17
(1,349 Views)

Hi mn,

 


@mnwooddog wrote:

 I would have to write the values to an array, which does not like complex values


As I have shown above you can easily create an array of complex values.

You again forgot to attach your current VI so we cannot tell you what you did wrong.

 

Did you learn about the meaning of coercion dots until now?

Did you try to implement my last suggestions about using WriteTextFile function?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 17
(1,345 Views)

I've attached the VI and a screenshot of the localized area I'm working on. I tried the WriteTextFile function, but I'm not sure if I implemented it incorrectly because right now I get an error regarding the file

Download All
0 Kudos
Message 13 of 17
(1,334 Views)

If you get an error, it is useful to also give the error number!

 

You really should familiarize yourself more with complex numbers, for example once you have the amplitude and phase, you could form the complex number directly using this tool. (Still, I think you could do the entire IQ processing on complex data directly)

 

I would probably combine the I and Q "Y values" from the beginning into a complex array and extract the singe tone, do the windowing and fft on the magnitude component (half the work!). Entire FOR loop code would fit on half a postcard!

 

altenbach_2-1614619907292.png

 

To write the complex data, you need to split it in RE/IM, e.g. as follows:

 

altenbach_0-1614619821568.png

 

ALso note that most if your code seems overly complicated, e.g. almost none of your sequence structures are really needed. Most controls belong before the loop! Way too many coercion dots! Some of your processing seems unnecessary and circular.

 

0 Kudos
Message 14 of 17
(1,324 Views)

Hi mn,

 


@mnwooddog wrote:

 right now I get an error regarding the file

write_to_text

Maybe the filepath is not correct? I guess you try to save a file while just giving a folder path?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 17
(1,309 Views)

@GerdW wrote:

@mnwooddog wrote:

 right now I get an error regarding the file

Maybe the filepath is not correct? I guess you try to save a file while just giving a folder path?


The Write To Text File does not create or replace the file.  If the file exists, you will likely only overwrite part of the file (possibly have some left over from the last write at the end).  Use Open/Create/Replace File with the action input set to "Create or Replace" and then use the Write Text File to write the data.  You should also use Close File afterwards.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 17
(1,302 Views)

@GerdW wrote:

Maybe the filepath is not correct? I guess you try to save a file while just giving a folder path?


Yes, you are confusing folders and files. At one point you are defining a file path, but never use it, while at the complex write, you seem to only give a folder. Note that once you form a 2D array, "write to delimited spreadsheet" would suffice. How often does the file change? Do you want to append the data from each iteration of the while loop to the same file or create a new file each time?

 

Also note that most of your code is overly complicated, even when forming the file name:

 

altenbach_0-1614628562398.png

 

 

 

 

0 Kudos
Message 17 of 17
(1,294 Views)