LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing spectrum analyzer trace in excel sheet columns

Solved!
Go to solution

Hi,

I am using R & S  FSL Spectrum analyzer. I want to store the trace of each sweep in columns of an excel sheet.

I am using the write to measurement file VI. But I am unable to write new sweep data in next column.

Can you please help me in writing the multiple sweeps in multiple columns in an excel sheet.

 

Example:

sweep 1 ---> write to column 2

sweep 2 ---> write to column 3

''

''

''

sweep 1000---> write to column 1000

0 Kudos
Message 1 of 7
(2,883 Views)
Solution
Accepted by topic author skk1

Hi skk,

 

collect your data in a 2D array, with adding a column for each new sweep.

Then save that 2D array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,873 Views)
Solution
Accepted by topic author skk1

If you have the Report Generation Toolkit, you can write individual Excel columns one at a time (indeed, in any order), but it will be easiest to do as GerdW suggested and write a 2D Array "all at once".

 

Bob Schor

0 Kudos
Message 3 of 7
(2,864 Views)

Thanks Mr GerdW, Its working.

Now I have a new problem.

I need to time stamp each sweep. I am trying to store the date and time string in first column.

 

Can you please go through the below attachments and help me.

Index for attachments

1. Required csv file time stamp information (excel data. PNG) 

2.  Time stamp block labview (time stamp labview.PNG) 

3. Labview program.

 

 

0 Kudos
Message 4 of 7
(2,834 Views)
Solution
Accepted by topic author skk1

It always helps to attach your code when you first post.  Some comments:

  • You are not writing Excel Sheets.  Excel is a Microsoft Product that has a proprietary data format.  What you are writing is a text file, with data arranged in rows and in columns-separated-by-commas, a "comma-separated-values" (or .csv) file.  LabVIEW calls this a "Delimited Spreadsheet" and uses <tab> as its default delimiter.
  • You are using third-party software (which we don't know about) to do your acquisition.  Is it safe for us to assume that the samples are all taken at a fixed sampling rate, so that the time between samples is always the same?  If so, you may not need every sample time, and maybe not any sample time, just the sampling interval.  Suppose you sample continuously at 1 kHz.  The first sample is at Time 0, the second at Time 0.001, the third at Time 0.002, and the Nth at Time (N-1)/1000.
  • You don't seem to understand LabVIEW's Timing Functions and TimeStamps.  You are using far too many Timing functions in your code, converting and unconverting "now" several times.
  • It definitely is possible to output CSV (Delimited Spreadsheet) file with the first column containing time information, and the remaining N columns containing sampled data from N channels.  Some questions to consider:
    • How many samples total, and how many samples do you take at one time?
    • Is the sampling continuous (i.e. the second set follows the first set without interruption?)
    • A 3 x 3 "example" of the desired format would be helpful.  Column 1 would be the Time column, and would show whether you want Date and Time, just Time, Time in "clock" format, Time in milliseconds, desired precision.  It would also show if you want "Absolute Time" (Wall clock) or "Relative Time" (Time starting at 0 for the first point).  Columns 2 and 3 would show desired data format.  Three rows would indicate if you want a Header Row and would clue us as to the expected sampling rate. 

Bob Schor 

0 Kudos
Message 5 of 7
(2,831 Views)

Thanks for the reply, 

  • How many samples total, and how many samples do you take at one time?

        I am taking 1000 samples in each sweep which are stored in one column, the recording continuous in along the rows for 10000 sweeps.

  • Is the sampling continuous (i.e. the second set follows the first set without interruption?)

       Yes the sampling is continuous

  • A 3 x 3 "example" of the desired format would be helpful.  Column 1 would be the Time column, and would show whether you want Date and Time, just Time, Time in "clock" format, Time in milliseconds, desired precision.  It would also show if you want "Absolute Time" (Wall clock) or "Relative Time" (Time starting at 0 for the first point).  Columns 2 and 3 would show desired data format.  Three rows would indicate if you want a Header Row and would clue us as to the expected sampling rate. 

       I want to record the date time with seconds in the same excel sheet for every trace. I have tried spreadsheet string to array but I am unable to store the date time (only 5 is written when 5/4/2019 10:34:32 PM should be written).

 

Please find the attachments.

 

Can you send me an example program writing the time and date continuously in a spreadsheet pls.

 

Download All
0 Kudos
Message 6 of 7
(2,828 Views)
Solution
Accepted by topic author skk1

You only get a "5" since Excel doesn't use the "/" in their date formats. I'm guessing that Excel checks if the first character to see if its numeric, and if so tries to force it to a default numeric or date/time format which your string doesn't fit, so it stops after the first character giving you a "5".  

 

You can try..

1) Enclosing your date format in " ".

2) Formating your date and time to fit an existing Excel format (D-M-Y HH:MM).

3) Use an Excel template where you set the row/column cell format to accept your data/time format.

 

Craig

0 Kudos
Message 7 of 7
(2,803 Views)