Saving complex numbers?

Hello all,
I need to save a calibration file...simple enough, but my calibration file is an array of complex numbers. I tried to find the proper precession (ie. %.3f) but I couldn't locate the precession extension for complex numbers. When I try to save the array I loose all of my complex numbers...so how do you save an array with complex numbers?
Thanx
Azazel
Azazel
Pentium 4, 3.6GHz, 2 GB Ram, Labview 8.5, Windows XP, PXI-5122, PCI-6259, PCI-6115

Hi,
You can try the attached VI which is a modified version of Write to Spreadsheet File function so that you can now write complex numbers to a spreadsheet or text file.
Regards,
Ankita
Attachments:
Write to spreadsheet file Complex.vi ‏59 KB

Similar Messages

  • 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

  • Tdms does not support complex numbers?

    I can see that I can create and manipulate complex waveforms in Labview, but when I try to save such a waveform in a TDMS file, I get a run-time error that data format is not supported, forcing me to split the complex waveform into two separate waveforms for saving.
    Also, when I send a complex waveform to a Waveform Graph indicator, it truncates the imaginary part.
    Are there any plans to add native support for complex numbers in TDMS and graphing?

    Fedor wrote:
    I can see that I can create and manipulate complex waveforms in Labview, but when I try to save such a waveform in a TDMS file, I get a run-time error that data format is not supported, forcing me to split the complex waveform into two separate waveforms for saving.
    That's correct. TDMS does not support complex values.
    Also, when I send a complex waveform to a Waveform Graph indicator, it truncates the imaginary part.
    That's also correct. Think about it. What would you plot on a waveform graph? You could use something like an XY graph, with X being the real values and Y being the imaginary values. Or, you could use a polar plot (available as a picture indicator plot).
    Are there any plans to add native support for complex numbers in TDMS and graphing?
    If you wish to make a suggestion regarding this, then you can post in the LabVIEW Idea Exchange, where people can vote on the idea. You may need to submit this as two different ideas since it's covering two different components.

  • I cannot re-open files that have been saved in Numbers version09 - it states "You need a newer version of numbers to open this document". This is the latest version

    I cannot re-open files that have been saved in Numbers version09 - it states "You need a newer version of numbers to open this document". This is the latest version & also the one I have created/saved???

    Jules,
    You may delete Numbers 08 if you wish, but some folks like keeping it around. Close all your Numbers docs and Quit the Numbers app, and the other Numbers app if necessary.Then click the Numbers icon on your doc. Then select Numbers > About Numbers, and in the window that pops up, see which version it is. If the Dock icon started Numbers 08, you can cure that by dragging that icon off the Dock and letting it go in a puff of virtual smoke.
    Now, to put the Numbers 09 icon on the Dock, double-click one of those known Numbers 09 documents so that Numbers 09 starts up. Verify by checkig Numbers > about Numbers.
    Now click and hold the Numbers Dock icon and select the Option for Keep in Dock.
    Jerry
    Message was edited by: Jerrold Green1 -- I inadvertently posted about Pages rather than Numbers. Just corrected it.

  • How to use RLS with complex numbers as the input?

    I import a file which have complex numbers, and I want to filter it using complex RLS adaptive filter, but it always freeze at the filtering and update then it returns one value in the matrix and all the other numbers are NaN, so how can I fix this.
    The second thing is when I use FBLMS, it always return error 42020 unless I specify the filter length= number of the input which is huge number, so how do I specify normal filter length.

    Hi engomar,
    There is a detailed description of how to choose filter length in the Adaptive Filter Tollkit Help file. 
    http://zone.ni.com/reference/en-XX/help/372357B-01/lvaftconcepts/aft_choose_filterlength/
    This page has several links to other important factors of what filter to choose. Under Computational Resource Requirements, it lists the memory usage for different filter types. RLS is the most memory intensive, which could be causing the freeze. Maybe try a LMS to see if this helps.
    Robert R. | Applications Engineer | National Instruments

  • Can't open a spreadsheet. Get message that spreadsheet is too old and needs to be saved with Numbers '09?

    Can't open a spreadsheet. Get message that spreadsheet is too old and needs to be saved with Numbers '09?

    HS,
    If you recently purchased a new computer, call AppleCare and describe your problem. Others who have done this have received an iWork '09 disk in the mail with which to do the conversion.
    Jerry

  • In range and coerce with complex numbers?

    I have an array of complex numbers with these numbers I need to set to 0 all numbers whose real parts are negative. With "in range and coerce" I can split the array into real and imaginary then set all negative numbers to 0 then recombine the complex part but that still leaves me with 0+ai numbers that should be 0. How can I also set the complex part to zero for the negative numbers?

    Hello,
    You can use the following fonction in a for loop with your array.
    Michel

  • Using complex numbers in Fletcher Reeves optimization method

    Hello,
    I would like to minimize a function of 4 complex variables with the Fletcher Reeves optimization method (Conjugate Gradient VI).
    Is it possible to do it with this VI or with HiQ4.5 ?
    (for S-parameters specialists) The purpose is to de-embed using optimization method.
    Thanks,
    Dze

    I believe that the "Conjugate Gradient nD.vi" and the optimize function in HiQ only work with real vectors. Most of the solve functions in HiQ work with complex numbers, and you may be able to create your own algorithm for the purpose, but I don't think that there is already a function that will do quite what you want.

  • I cant open a document saved in Numbers

    Please help me! I cant open a document that I saved in Numbers as it says "could not be open" Why is this happening?

    Quit the app.
    From the menu bar, select
     ▹ System Preferences... ▹ iCloud ▹ Documents & Data: Off
    Relaunch the app. There will be a delay before your documents stored in iCloud reappear.
    Credit for this solution to ASC user Kreklo.

  • Hp 35s integrating with complex numbers/functions

    Are there any examples of how to integrate a complex function for
    the HP 35s..the manual suggests its possible..but, I can not find one
    example...anywhere... I am just interested in testing.....I do
    not want to break things into parts etc...I just want to try
    e^z for example, where z is complex..any help?
    I have tried xiy, rTheta, x+iy...syntax errors or non existent..funny

    Hi,
    The manual states that complex numbers can be used with EXP(x), but it does not mention anything about using complex numbers for integration. Edit: I missed some text in the manual, see below.
    As far as I can tell it cannot do integration with complex numbers. (The 50g can do this.)
    However, you may get a more definitive answer if you ask your question here:
    http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi
    EDIT: that forum has moved to a new version:
    http://www.hpmuseum.org/forum/forum-4.html
    Note: I do not work for HP, I just like playing with calculators :-)

  • Complex Numbers problem

    I am having problems getting this Complex Numbers program to work correctly. i want to display using format a+bi the addition, subtraction and multiplication of 2 complex numbers.Can anyone reply today?
    class Complex
         private double realPart, imaginaryPart;
         public Complex()
              realPart = 0.0;
              imaginaryPart = 0.0;
         public static void main(String [] args)
              Complex c;
              double res;
              c = new Complex();
              Screen.message("-------------------MENU----------------------------");
              Screen.newline(2);
              Screen.message("Please enter a number: ");
              Keyboard.readDouble();
              res = c.get_realPart();
              Screen.newline();
              Screen.message("Please enter a second number: ");
              Keyboard.readDouble();
              res = c.get_imaginaryPart();
              Screen.newline(2);
              Screen.message("--------------------------------------------------");
              Screen.newline();
              Screen.message("     Designed by Niall Magner               ");
              Screen.newline();
              Screen.message("--------------------------------------------------");
              Screen.newline(2);
              Screen.writedouble(res);
              Screen.newline();
              Screen.writedouble(res);
              Screen.newline();
              Screen.writedouble(res);
              Screen.newline(2);
         public double get_realPart()
              return realPart;     
         public double get_imaginaryPart()
              return imaginaryPart;
         public void addComplexNum(Complex n1, Complex n2)
              realPart = n1.get_realPart() + n2.get_realPart();
              imaginaryPart = n1.get_imaginaryPart() + n2.get_imaginaryPart();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
              Screen.message("Number 1 is: " + realPart);
              Screen.message(" + " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("Number 2 is: " + realPart);
              Screen.message(" + " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
         public void subtractComplexNum(Complex n1, Complex n2)
              realPart = n1.get_realPart() - n2.get_realPart();
              imaginaryPart = n1.get_imaginaryPart() - n2.get_imaginaryPart();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
              Screen.message("Number 1 is: " + realPart);
              Screen.message(" - " + imaginaryPart + "i");
              Screen.newline();
              Screen.message("Number 2 is: " + realPart);
              Screen.message(" - " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
         public void multiplyComplexNum(Complex n1, Complex n2)
              realPart = n1.get_realPart() * n2.get_realPart();
              imaginaryPart = n1.get_imaginaryPart() * n2.get_imaginaryPart();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
              Screen.message("Number 1 is: " + realPart);
              Screen.message(" * " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("Number 2 is: " + realPart);
              Screen.message(" * " + imaginaryPart + "i");
              Screen.newline();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
    Any help greatly appreciated.
    Niall Magner

    There are several problems with this code. You never call the add method, so the numbers are never going to be added. You never load up a complex number to add either.
    Try doing something a bit more like this:
      read a float from the keyboard
      read another float from the keyboard
      Create a complex number from this float
      Complex complex1 = new Complex();
      complex1.realPart = first number from above;
      complex1.imaginaryPart = second number from above;
      do this again to get the second complex number
      then add the numbers together
      Complex complexSum = new Complex
      complexSum.addComplexNum(complex1, complex2)
      print complexSum.realPart + "+i" + complexSum.imaginaryPart;
      then do the other operations you wantI would also advise that you take a course in Java Programming, cos the code you have posted is truely awful.

  • How do I write complex numbers to an excel or text spreadsheet file.

    I am performing an FFT on 3 channels of simultaneous analog input. I want to write the resultant 3 complex numbered arrays to a spreadsheet. Do I have to seperate the a and b*i components into r and theta and write two columns per array or is there a better way?

    Perhaps you can write it as a String..?
    Khalid

  • SVD with complex numbers

    I'm working on creating a SVD class using complex numbers. I have an adaptation of the Jama ( http://math.nist.gov/javanumerics/jama/ ) implementation coded which works great with complex numbers with only a real part, but fails when the imaginary is present. I also coded up a port of numerical recipes' ( http://www.nr.com ) implementation, but am unable to get it to converge. I'm 99.9% sure that the problem does not exist in my complex number class as it has worked fine up until now.
    Anyhow, what I'm wondering is if anyone has a Java SVD for complex matrices that I could look at and/or use?
    Thanks in advance,
    m

    It wasn't working when I tried it a few months ago. I found the bug in the database - it's been long-standing. Given that Sun doesn't appear to be supporting Java3D very well, I doubt it'll ever be fixed.
    Besides, that SVD algorithm is only for real matricies, I believe. - MOD

  • MupdfPage: an add-on for mupdf for auto-loading/saving page numbers

    I love MuPDF, but it doesn't store page number before you exit as other viewers do. I wrote a new header 'pdfpage.h' under the 'apps' directory and hacked 'pdfapps.c' a bit so that now it auto-saves and loads page numbers. The hack is based on a svn version, which keeps changing and makes patching hard, so I put my hacks in the README.txt.
    The source can be retrived here: https://github.com/kaikaizi/mupdfPage/
    To use, clone latest source:
    git clone git://git.ghostscript.com/mupdf.git
    drop 'pdfpage.h' into apps directory, and apply the 4 changes in 'pdfapps.c'.

    Check out llpp and zathura. The former uses mupdf to render PDFs, the latter can (with a plugin). Both are very fast (llpp just FLIES), and have that auto-loading/saving page numbers. And, zathura has genious keybindings.
    But cool project. Thanks.

  • Need help with complex numbers ..

    Hi!
    Just want to check if i got it right - if anyone could pls confirm:
    public void divComplex(Complex a, Complex b)
    x = ((a.x * b.x) + (a.y * b.y))/((b.x * b.x) + (b.y * b.y));
    y = ((a.y * b.x) + (a.x * b.x))/((b.x * b.x) + (b.y * b.y));
    public void multComplex(Complex a, Complex b)
    x = ((a.x * b.x) - (a.y * b.y));
    y = ((a.x * b.y) + (a.y * b.x));
    where:
    protected double x;
    protected double y;
    is declared to represent the complex number .
    Is this correct?
    Siw

    For the division you have,
    a/b = a*b'/b*b' = a*b'/|b|
    |b| = (b.x + ib.y)*(b.x - ib.y) = b.x*b.x + b.y*b.y
    a*b' = (a.x + ia.y)*(b.x - ib.y) =
    (a.x*b.x + a.y*b.y) + i(a.y*b.x - a.x*b.y)
    There seems to be a slight mistake in the imaginary part (y).
    y = a.y*b.x - a.x*b.y / (b.x*b.x + b.y*b.y);
    But don't take my word for it. It's been ages since I did complex numbers -:)

Maybe you are looking for