From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing sensor data in excel

Solved!
Go to solution

@acuteboy wrote:

Is there any practical example, how this can be realized in practice. Or how the nested for loops can be used for saving data in this fashion.

 


OK, let's say you have 6 X positions and 5 Y positions, so you will be collecting 6*5=30 Z Values.

 

Here is some pseudo-code as a Snippet.

Delimited Example.png

 

Bob Schor

 

P.S. -- is the opposite of "acuteboy" "obtuseboy"?  I hope not ... 

P.P.S. -- I'm sure others have pointed this out, but this is not "Writing sensor data in Excel".  True, Excel can read these data (as it can "read" any text-formatted data), and Microsoft has created an Icon and set Excel as the default program to open .csv files, but such files are not Native Excel files, which allow cell-based formatting to allow you (as your example shows) to clearly color-code Data and Header information.

Message 11 of 15
(918 Views)

Hi, 

 

I tried to wite the data in the csv format using "Write delimited spreadsheet". To some extent its working but not as needed.  i have attached the picture of actual result and expected result. In the first coulum the values aur being written on the Z values (maybe from data picture it will be more clear).  Such that at the end 1 coulumn of data is missing. Can somebody tell me what i have donr wrong here. 

Download All
0 Kudos
Message 12 of 15
(902 Views)

I have tried in this way also but same result:

 

VI.png

0 Kudos
Message 13 of 15
(893 Views)
Solution
Accepted by topic author acuteboy

Well, I took a look at you code, said "I don't want to have to wade through this", and started writing my own version.  I was going to follow my own advice, create a rectangular data array, then "wrap around it" row and column 1-D or 2-D (2-D if I wanted to include blanks as separators) to put in X and Y Index values (i.e. 1, 2, 3) or the actual X and Y values used to generate the Z values.

 

So one of the first "complications" is that you have to convert all of your numeric data to Strings before trying to write the Delimited (not-really-Excel) "Spreadsheet", as there's no way to write a blank entry if you are writing numerics.  Further, "wrapping" the row and column headers gets messy really fast.

 

So what's the answer?  If you have the Report Generation Toolkit, then just use it and write to Excel!  The RGT has functions that let you write a 1D row of numerics in Row 0, Column 1 (or, in Excel lingo, Cell B1) that can be your column headers, a 1D column of numerics starting in A2 that can be your row headers, and a 2D array of numerics starting in Cell B2 that are your Z Data.  If you want to get really fancy, you can color the Row and Column Header Cells to make them "stand out" from the Z data.

 

Just for fun, I'm attaching my attempt at your Mesh (which I called "A Real Mesh") just before I realized this was far too much work, and I hadn't even added the blank row or the Row Headers ...

A Real Mesh.png

 

Bob Schor

0 Kudos
Message 14 of 15
(892 Views)

Thanks for the reply. Unfortunately i dont have the report generation toolkit. So i kind of used your snipet and tried to implement it. At last i am able to save the data in the format i needed. Maybe the solution is not how the professionals in this forum would do it but for the moment it serves my purpose. Now the main task is to implement this idea using the actual singnals i am recieveing from the encoders and distance sensor. Thanks a lot everybody for the help and support.

 

 VI1.png

0 Kudos
Message 15 of 15
(872 Views)