LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array with Complex Numbers

I am attempting to export an array with complex numbers in the form x+yi to a txt file. We need this form as opposed to two columns with separate values because MATLAB needs it in the form x+yi. Right now it is only writing the x value to the txt file. Do I maybe need to change the format for Write Delimited Spreadsheet? Any suggestions would be appreciated. 

0 Kudos
Message 1 of 17
(3,004 Views)

I'd use Complex to re/im and format it manually, but there might be some hidden gem that automates that. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 17
(3,001 Views)

Hi mn,

 

as you forgot to attach your VI we cannot tell you what you did wrong!

 

For me it works as expected:

 


@mnwooddog wrote:

Right now it is only writing the x value to the txt file. Do I maybe need to change the format for Write Delimited Spreadsheet?


As you forgot to attach your VI we cannot see the coercion dot in your code which warns you about (unexpected?) datatype conversions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 17
(2,998 Views)

GerdW is close.  You just have to search and replace the SPACES with NOTHING  Matlab hates the dang space as I recall.


"Should be" isn't "Is" -Jay
Message 4 of 17
(2,965 Views)

I've attached the VI (but it's very convoluted with everything we're doing, so I've also attached a screenshot on the area I'm focused on). 

Download All
0 Kudos
Message 5 of 17
(2,959 Views)

I will give your method a try. I've replied to my original post with the VI and a screenshot of the specific area I'm addressing

0 Kudos
Message 6 of 17
(2,955 Views)

See that ugly red colored dot on the orange wire?  That is where your Complex Double is Coerced to Double


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 17
(2,950 Views)

Oh, I see! How do I fix that?

0 Kudos
Message 8 of 17
(2,938 Views)

How would you then output your spreadsheet string to a txt file? How I have it set up now there is an output of Build Path connected to an output of Array to Spreadsheet String. 

0 Kudos
Message 9 of 17
(2,927 Views)

Hi mn,

 


@mnwooddog wrote:

How would you then output your spreadsheet string to a txt file?


When I want to write strings to a textfile then I use a simple WriteTextFile function.

Sounds very logical to me…

 


@mnwooddog wrote:

How I have it set up now there is an output of Build Path connected to an output of Array to Spreadsheet String. 


Again you forgot to attach your VI so we cannot tell you what you did wrong in your VI…

But how do you connect the output of one function to the output of another function???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 17
(2,908 Views)