LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Headers to a Spreadsheet

Hi all,

 

in my software I am able to tell instruments to do a specific measurement more than once- the number of scans is selected by the user. At the moment, it saves separate scans as 'Date, hour, scan x', where 'x' is the number of scans.  I'd like to add headers to it, so the first columns would be entitled 'Time', 'Channel1', 'Channel1' and 'delta A'. I've tried routing it, but it always causes some errors and I have no idea what to do any more. Sorry if this sounds confusing and I'd really appreciate your help. 

0 Kudos
Message 1 of 18
(5,922 Views)

Hi,

U can use another spreadsheet and specify the path and assign your header names as an array.

This may helps to you.

0 Kudos
Message 2 of 18
(5,916 Views)

You could always convert your data array into an array of strings, add the headers to the font, and then use the Write To Spreadsheet File.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 18
(5,904 Views)

hello,

how to add a header to xlswrite when this header is generated after the data array (string) of 50Mo ? 

I believe that I need to read the xls file containing already the data array, then build new array with {header+array} and replace previous file.

I have issues to open/read the big initial (50Mo) xls file, before inserting header. 

So I am wondering if there is a way to overcome this file size read limit, if any limit there is, cause maybe it is problem of setting in Labview, or a problem of DRAM on my computer ? 

0 Kudos
Message 4 of 18
(4,814 Views)

Write your headers to the file BEFORE you enter your acquisition loop.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 18
(4,809 Views)

Probably not enough clear for expert, sorry for that. 

Of course, writing header before is not an issue, and does not need to be requested as a question on this forum. But the case of adding headers after an array of large size of data is an issue. This is the meaning of my question otherwise I will have not attended to bother you with this problem. 

My case happens, for example, when you are preparing a header that includes some experimental conditions that user can write all along the recording. For example "at time 30sec, I start to supply voltage". This cannot be added BEFORE. 

But when user are generating large data size, adding a text header prior to the data is resource consuming. This is also the aim of my question. 

 

0 Kudos
Message 6 of 18
(4,803 Views)

You can't add stuff before if you've already written the data.

So write the notes after at the bottom of the file!

0 Kudos
Message 7 of 18
(4,800 Views)

You have already answered your own question.  Since you have a requirement that you need to gather some header data after you've started writing the data-for-which-it-is-a-header, you can accomplish this by writing two files, a Data File, where you keep track of "time" or "lines of text", and an "Other Information" file that has "header" and other time/position-sensitive (but otherwise asynchronous) information in it.  Once the data collection has finished, and the two files closed, you can decide whether or not you want to merge them, interdigitating them as you desire, or leave them separated, linked by knowing how the various lines of the two files are related (an easy way to do this is to start each line of both files with a TimeStamp, allowing you to order the information chronologically).

 

Don't be afraid of writing multiple (related) files -- it can really simplify your data collection/data processing tasks.  Been there, done that!

 

Bob Schor

0 Kudos
Message 8 of 18
(4,795 Views)

thank you Bob for the advice. I really need to build 1 file rather than multiple files. The reason is post-treatment with Matlab, that is picking up some lines of the header (always at the same line number) to compute all the data. 

The second reason is that when my program is ending, I am sending the text file of data into the dropbox of a student/user. So this text file contains everything (experimental conditions and data), it is very convenient. But those files usually are 30Mo or 50Mo. I had issues for reading text file and add header, when data size is >50Mo. 

0 Kudos
Message 9 of 18
(4,793 Views)

Sorry to say that this option cannot answer my problem. The header must be at top of the file. Per definition, a data array depends on experiment length, so the bottom of the file is usually unpredictable. 

Second argument is that usually, data are ready for post-treatment with Matlab. The header contains some variables that Matlab is pointing to. So those header infos must be a the beginning of the file. 

"You can't add stuff before if you've already written the data."  : clearly no, it is possible to do it. But it depends on file size. My issue concerns how to do it when file size is large. 

 

0 Kudos
Message 10 of 18
(4,791 Views)