03-01-2021 08:44 AM
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
03-01-2021 09:01 AM
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?
03-01-2021 10:59 AM
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
03-01-2021 11:34 AM - edited 03-01-2021 02:11 PM
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!
To write the complex data, you need to split it in RE/IM, e.g. as follows:
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.
03-01-2021 01:11 PM - edited 03-01-2021 01:13 PM
Hi mn,
@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?
03-01-2021 01:40 PM
@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.
03-01-2021 01:58 PM
@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: