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: 

Problems writin to spreadsheet

Solved!
Go to solution

I switched format to %d and it worked only twice. For some reason, it is back to putting 0's on the spreadsheet. This is going to make me an old man quick!

0 Kudos
Message 11 of 17
(1,311 Views)

It sounds like labview is having trouble converting the instrument string into a number.  Can you paste the string from the instrument onto this forum?

Message 12 of 17
(1,309 Views)

Yes Sir, attached is my test Vi. Putting a probe on it in Highlight Execution mode, the problem lies in the Fract/Exp String To Number, because the numbers from the VISA read are correct, yet on my spreadsheet it keeps coming up 0. I thought I had it fixed with the %d but it isn't.

Thank you

0 Kudos
Message 13 of 17
(1,294 Views)

Oh, I didn't realize what I sent you was after I deleted the Write To Spreadsheet Vi. That is where the problem lies, not in the Fract/Exp String to number. Sorry about that. The Write to spreadsheet goes to the far right and the output of that Build Array. Once you do so and run the Vi, it will produce only 0's. Thanks again.

0 Kudos
Message 14 of 17
(1,290 Views)

It sounds like your VIs work fine. If you are able to get the code to work when you use a simulated instrument, then the problem is with the data from your instrument, not with the code.

 

What kind of data is the instrument producing that you are trying to write to the spreadsheet? It's likely some data type / formatting / etc issue with the data and with your code.

Message 15 of 17
(1,249 Views)

I agree.  Can you post some of the data that is actually coming from your instrument?

Message 16 of 17
(1,242 Views)

@Bob_Schor wrote:

I'm sorry my attempt to write clearly failed so badly.  Here is a Snippet that writes a Spreadsheet (and reads it back to show you what has been written).  The Data are 5 rows of 3 columns of random numbers.  The Spreadsheet has a Header Row with Column 1, Column 2, and Column 3, and the data are written a row at a time to the same Spreadsheet.  There is a For Loop with an index of 5 that is the "Generate and Save the Data" loop -- it could be a While loop controlled by a Stop Control.  The 3-indexed For loop before entering the Acquisition Loop is to generate and write the three-column Header Row.  When we exit the Acquisition Loop, we read the Spreadsheet to be sure it did what we wanted it to do.

 

So my question is, did you try to get this to work?  You should have been able to whip up this little demo program yourself.  If you are having trouble with something in LabVIEW (like figuring out how Write to Spreadsheet works), it is much easier (not to mention faster, and more fun) to not try to debug it inside a much larger routine where lots of other things are going on.  Write a tiny demo program (such as shown below) that just tests what you are trying to understand.  If it doesn't work, read the LabVIEW Help, experiment with settings, and if you need to go to the Forum, post the little Demo routine.

Spreadsheet with header.png

 

When I went to post this Snippet, I forgot that I'd answered a similar question in the Forums about two weeks ago.  There I included how to do this to an Excel Workbook, as well as a LabVIEW "Spreadsheet".  Here it is (very similar, of course ...).

Spreadsheet with header.png

Hmm -- looks like I forgot to put the File Specification in the Write-to-Spreadsheet part of this example ...

 

Bob Schor

 


YES!!!! Thank you SIr. It took me a while but I got it now. There really is no substitute for just playing with the software. Thank you

0 Kudos
Message 17 of 17
(1,190 Views)