Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

Hi Biz
I don't think there is a direct way of converting a complex number to a
string, so when you convert the array to a spreadsheet string, the
numbers would be converted to real data.
However, you could try separating the real and imaginary parts using the
"Numeric: Complex to Re/Im" function, and then store these - either in
separate files or in adjacent columns/rows in the same file. Then, when
you read in the data again, use the "Numeric: Re/Im to Complex" function
to put the two "halves" together.
If you actually want Excel to interpret the numbers as imaginary, then
you'll probably want to create a string for each complex number of the
form "Re + Im*i" (after separating the Re and Im parts), by using
"String:Format into String" with 2 numeric inputs and the format string
"%f+%fi".
Reading the data back into Labview then would require splitting the
string into the 2 pieces by using "Stringcan from String" with 2
numeric outputs (smae precision as original numbers specified by the 2
Default Value inputs) and the same format string "%f+%fi", and then using
the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
me, so if you can't follow what I am describing, send me an email and I
can email you what I did (LV 5.1.1).
Paul
Biz wrote:
> Having trouble converting array to spreadsheet string, storing the
> file and coverting back to array with complex numbers
>
> I am working with a network analyzer. I have arrays made of 5 columns
> the first consisting of an integer and the next four consisting of
> complex numbers. I am converting the array into a spreadsheet string
> and then saving the file using the write characters to a file VI. That
> seems to work well as when I open the file in Excel all the data is
> there. However when I try to reverse the process, open file and
> convert back to array, I loose some of the data. Specifically the
> imaginary parts of my complex numbers are all going to zero. I have
> narrowed down the problem to be in the conversion from spreadsheet
> string to array and vice versa. I think the problem may be with the
> 'format' input to the VI. I do not have an adequate resource for this
> so I am not sure what to put in to accomplish my task. Any takers?
Research Assistant
School of Physiotherapy, Curtin University of Technology
Selby Street, Shenton Park, Western Australia, Australia. 6008
email: [email protected]
Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
"Everyone who calls on the name of the Lord will be saved." Romans 10:12
"For all have sinned and fall short of the glory of God, and are
justified freely by his grace through the redemption that came by Christ
Jesus." Romans 3:23-4

Similar Messages

  • Trouble with array to spreadsheet string

    I am having trouble with the array to spreadsheet string.
    I have a 1-d array of string, the output spreadsheet string never puts a space on the first row, but all others.
    example:
    05:59:29.170    00000101     8        00 00 07 00 0B 0E 0D 0C
     05:59:29.198    00000100     8        00 00 3A 3A 39 39 39 39
     05:59:29.220    00000101     8        00 00 07 00 0B 0E 0D 0C
     05:59:29.248    00000100     8        00 00 39 39 39 39 39 39
    format string is %s and default tab is delimiter.
    this is screwing up my program because of the "scan for string" function can't be used correctly if the spreadsheet string isnt consistent.
    Any suggestions?
    Thanks

    You don't need to use "array to spreadheet string": You could use plain formatting for full control over the output.
    Still, your observation is a bit odd. Could you attach a simple VI that shows the behavior? (Put your input array into a diagram constant).
    LabVIEW Champion . Do more with less code and in less time .

  • Array To Spreadsheet String -- Convert EOL Option

    The Array To Spreadsheet String and Spreadsheet String To Array functions should provide an option for (not) converting EOL (end-of-line) to platform-dependent ones. I am thinking of something similar to the Write/Read Text File options where you can place a checkbox in the context menu "Convert EOL". As per default such checkbox need to be checked for compatibility reasons.
    Possibly another option/checkbox for not appending the final EOL would be nice, maybe "Final EOL" checked per default as well.

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • Array to spreadsheet string - remove space after delimiter

    Hi
    I created a Labview program to acquire a electrical signal and send it using TCP/IP.
    The image in attachment shows a piece of my code. The AQ subVI was created by me to accomplish the acquisition.
    However, the string that the "array to spreadsheet string" VI returns is something like this:
    -0.800781^ -1.030273^ -1.098633^ -0.942383^ -0.644531^ -0.209961^ 0.258789^ 0.712891^
    The VI is using the ^ character as a delimiter and it is converting commas to points as decimal separators.
    Now, what i would like to do is to remove the space character between the ^ character and the sample value, simply because that is what the receiver of the TCP/IP message wants.
    Can anybody help me?
    Thanks in advance
    Attachments:
    Array to spreadsheet.png ‏7 KB

    hi there
    remove the space between the ";" and "%" in your format specifier.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • \0D and \0A after array to spreadsheet string conversion

    Hi guys, i currently have a VI that manipulates a couple of arrays and writes them to a config file through the config VI.
    Now, i notice 1 problem whereby after my array is comma delimited and converted into a spreadsheet string, a tab and carriage return automatically appears at the end of the string. This causes my resulting config file to have \0D and \0A to appear with my keys in the config file.
    I know it's got to be the array to spreadsheet string conversion that's causing the problem because i don't have such \0D and \0A problem with keys without the conversion.
    How do i solve this?

    The OD and OA are the carriage return and line feed and yes the functona always appends these characters at the end of each line. Probably because this function is normally used to create files that a spreadsheet can read. There are several ways to remove the extra characters. Shown below is the string reversed and the String Subset function uses an offset of two. The output of that is reversed to get a string without the CR and LF. Also shown is getting the string length, subtracting 2 and wiring that to the length input of the String Subset function.
    Message Edited by Dennis Knutson on 07-26-2007 10:57 PM
    Attachments:
    Strip Last Two Characters.PNG ‏6 KB

  • Array To Spreadsheet String and DDE

    I have an array (one dimensional) that I want publish as a dde topic.
    So far I've been able to write all my dde components appear to be working,
    with the exception of the dde set value function in conjunction with Array
    To Spreadsheet String function.
    Array to spread appears to parse the the array the way I want it (that is,
    to create one
    big string with newline chars seperating tokens) but it's output does not
    seem to set correctly. If I look at the value right after I convert it to
    a spreadsheet
    string its good, but if I check it (once it's been loaded) using
    DDE Srv Check Item it comes up blank.
    Does anyone know what I'm doing wrong? I'm feeding the output of array
    to spread driectly into DDE Srv Set Item, shou
    ld it be going through another
    function first? Or am I using the wrong function to parse my array? My
    DDE
    server seems to work ok if I just use single string values, is there something
    about using arrays that I should be aware of? Any feedback is appreciated.

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • I'm having troubles converting my raw files from Nikon D5200 (NEF) to DNG. I tried using Lightroom 4, but it didn't identify the folder containing the files. So i downloaded the latest DNG converter but that too didn't identify the files kept in the folde

    I'm having troubles converting my raw files from Nikon D5200 (NEF) to DNG. I tried using Lightroom 4, but it didn't identify the folder containing the files. So i downloaded the latest DNG converter but that too didn't identify the files kept in the folder location. So I downloaded DNG converter v7.3 for D5200. It identifies the folder and files; but it is giving me parsing error on trying to convert files. I'm running Windows Vista Home Edition SP1. Kindly advise. Thank you.

    I probably missed this detail in what you’ve posted, but do you see the thumbnails of the three cameras’ raw files in Finder if you don’t convert to DNG?
    What has happened in the past is that the Apple raw interpreter doesn’t read thumbnails of DNGs it doesn’t like, where at least one thing it didn’t used to like was embedded lens corrections for mirrorless cameras.  Are the Olympus and Panasonic mirrorless—meaning there is no optical viewfinder and everything is seen on an LCD screen or perhaps an electronic view finder?  If so the reason these are different is that the camera is doing the lens distortion corrections automatically and this information is stored in the raw files and in the DNGs but Apple doesn’t know how to use these embedded lens corrections or doesn’t know how to read the newer DNG spec that does allow for this information to be embedded in the DNG, at least.
    Apple could just extract the embedded jpg preview and ignore the other parts of the file it doesn’t understand, but it apparently doesn’t do this.
    What I’m not sure about is if the Apple raw interpreter still has this problem or if you’re on an older system without the latest updates for camera raw decoding by Apple.

  • Write array to spreadsheet string

    Hi,
    I have 3 numeric arrays and 1 string array.  I am try to use the function write array to spreadsheet string.  What is the easy way to do this, since I have both numeric and string, I can't create a 2d array directly?
    Yik
    Kudos and Accepted as Solution are welcome!
    Solved!
    Go to Solution.

    It depends how you want the file to store the data.
    Attached is an example of two methods mentionned above.  You can change the formatting so that you have the data on the same line or different lines.
    There are many solutions depending on exactly what you want to accomplish.
    --- didn't expect to see so many replies so quickly ---
    Most people recommend converting the numeric array to string array first.  I offer an alternative   or a choice of both.. 
    Attachments:
    exampleOfWriteDiffArrayToSprdsht.png ‏28 KB

  • Deleting all elements from array and array to spreadsheet string

    Hello,
    I would like to write a new data file for each "recording" session without closing the VI.  My problem is that the last "recording" session's data is at the top of every successive session's text file.  I do not want this.  I've tried to delete all rows from the array after my array to spreadsheet string function, but I think the problem is somewhere with the shift register and how the array is built.  I'm not too familiar with LabView and this aspect of my interface is driving me crazy.  Attached is my code and two successive data files.  I have not been able to find a solution on these or the LAVA forums.  Any help would be appreciated.
    Also, I know there is an easier way to write this kind of streaming data, but I need to do it this way for other devices and synchronization purposes.
    Attachments:
    testsecond.txt ‏90 KB
    test41.vi ‏80 KB
    testfirst.txt ‏78 KB

    A few more comments to your code:
    Your loop does not have a wait, meaning it spins the empty case millions if times per second, consuming all CPU while not doing anything. Add an indicator to [i] to see.
    To clear a 2D array in one case frame, just don't wire the output tunnel and set it to "use default if unwired". You'll get an empty array. No fancy tools needed.
    I probably would use an event structure and also protect the data if the save dialog is canceled.
    Here's a simple draft that probably requires a bit more work but should show some of the ideas.
    You should also
    add some protection that the VI cannot consume all available memory if it runs forever.
    Create a seperate case to save the data later if the file dialog is cancelled the first time.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    test41MOD.vi ‏107 KB

  • Array To Spreadsheet String, Empty Delimiter

    The Array To Spreadsheet String function does not accept an empty Delimiter, it uses the Tab character in such case.
    The same is true for the Spreadsheet String To Array function (but of course this function cannot work without a Delimiter).
    I would appreciate one of the following options:
    to allow an empty separator for both functions (for Array To Spreadsheet String this can easily work obviously; for Spreadsheet String To Array you might see an empty string delimiter between each two adjacent characters similar to the Search and Replace String function with an empty search string);
    to document that behaviour properly;
    I would prefer the first option espacially for the Array To Spreadsheet String function. What do you think?

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • I'm having trouble converting my RAW files to jpegs. Even though my RAW files are 90MB plus, the jpegs when converted are only around 6MB.  Am I doing something wrong?  Thanks,  A

    Dear Forum,
    I realise this isn’t necessarily your problem, buy I’m having trouble converting my RAW files to jpegs.
    Even though my RAW files are 90MB plus, the jpegs when converted are only around 6MB.
    Am I doing something wrong?
    Thanks,
    A

    HHi Barbara, thanks for replying to my post.
    No there's nothing wrong with the Jpegs, but I want to srart uploading images for sale in Alamy, but they say they must be a minimum of 17mb un compressed. Does that mean that at 6mb compressed from 90mb they'd be acceptable?
    thanks,
    alex

  • I am having trouble converting a word doc to PDF.

    Dear Community,
    I cannot convert a Word document to PDF.  It has always worked before and I tried a small word doc and it worked fine.  Is my other document too big?
    Thanks

    Bill,
    You were right.  I checked the file and I had an earlier compatibility problem.  I converted the file to a newer version of Word and so far it seems to have worked.
    Thank you for your help.
    Bryon Zambello
    513-702-0188

  • I am having trouble, my icloud is using an old Apple ID, and i can no longer access that email account, or know the password to that, how do i switch it?

    I am having trouble, my icloud is using an old Apple ID, and i can no longer access that email account, or know the password to that, how do i switch it to my new Apple ID?

    Having the email address is not necessary. It is just the username for the device. All you need is that Apple ID and password. Now, if you forgotten the password, then you have more work to do. Since that email is no longer active, you would need to send the reset to your rescue email, if you remember that. Or you will need to contact Apple Security for help. Apple ID: Contacting Apple for help with Apple ID account security

  • HT1222 Having trouble updating to  11.1 on my iPhone 5 and I can't download any music from iTunes to my iPhone because it says I don't have 11.1

    Having trouble updating to  11.1 on my iPhone 5 and I can't download any music from iTunes to my iPhone because it says I don't have 11.1? How can I update iTunes on iPhone?

    You update iTunes on your computer to 11.1.

  • I am having trouble installing itunes on my computer. The error says, "Service Apple mobile device failed to start. verify that you have sufficient privileges to start system requirements." this is my home PC.

    I am having trouble installing itunes on my computer. The error says, "service apple mobile device failed to start. Verify that you have sufficient privileges to start system requirements." this is my home PC.

    Hi Iss9243,
    Welcome to the Support Communities!
    You've already tried some great troubleshooting steps, but the article below gives you quite a few more for this issue.  Hope it helps ....
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Cheers,
    - Judy

Maybe you are looking for

  • Reports 6i and mail

    Hi all, how can i read the report that i sent it to my mail through the option that exits in report 6i. Is extension is (eps). Best Regards, Hany

  • User Exit or BADI in APO to change sales order relevant data while CIF

    Hi Everyone, I require User exit or BADI at APO side to change customer field kunnr of sales order after it enters APO through CIF. My requirement is to replace KUNNR field with KDGRP field of sales order. The data will pass through CIF in APO. Is th

  • Exporting pdf's from InDesign

    I'm looking for a simple and effective way to export my InDesign document as single page pdf files, with a specific filename suffix. I'm hoping that the file name suffix can come from the numbering and section options from my InDesign document. To be

  • How to skip and restart a failed worker using ADCTRL command line?

    To skip and restart a failed worker, we can start adctrl, use hidden option (7 or 8 depending on the version). Is it possible to do the same from command line? Thanks in advance. S. Sundar

  • How should I set up my Time Capsule after a clean install of Mountain Lion?

    I just did a clean install of my computer.  I have been using time machine to backup everything to a time capsule.  I used migration assistant to reload my stuff to my computer.  I want to get time machine up and running again but I am not sure what