02-24-2021 08:56 AM
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.
02-24-2021 09:03 AM
I'd use Complex to re/im and format it manually, but there might be some hidden gem that automates that. 🙂
02-24-2021 09:03 AM - edited 02-24-2021 09:05 AM
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…
02-24-2021 10:04 AM
GerdW is close. You just have to search and replace the SPACES with NOTHING Matlab hates the dang space as I recall.
02-24-2021 10:13 AM
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).
02-24-2021 10:16 AM
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
02-24-2021 10:19 AM
See that ugly red colored dot on the orange wire? That is where your Complex Double is Coerced to Double
02-24-2021 10:46 AM
Oh, I see! How do I fix that?
02-24-2021 11:09 AM
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.
02-24-2021 01:12 PM - edited 02-24-2021 01:13 PM
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???