Jump to content

write to spreadsheet


Recommended Posts

Hello!

I apolgize for my very basic questions but I am very new to LabVIEW (I just started using it last week!) and therefore am not very good at troubleshooting yet.

I have created a VI (attached) that registers the start and stop time of a set of switches. I am trying to figure out how to write the collected data to a spreadsheet. Ideally, I would like to subtract Stop Switch #1 from Start Switch #1 and obtain a value which would then be written to a spreadsheet. And continue this process for all six switches (Stop #2 minus Start #2, Stop #3 minus Start #3, Stop #4 minus Start #4 ect...) so I would have six values written to my spreadsheet.

If it is easier however, to write all 12 values to the spreadsheet, I can just subtract the respective values once in excel to obtain my desired result.

Thank you so much for your help! If possible, it would be best if you could show me on Labview itself. I am a visual learner and struggle when given actual sentences and have to turn them into programming...

Please let me know if you need any clarification on what I am trying to do!

Thanks Again!

working_twelve.vi

Link to comment

Thanks for your help!

I am having trouble with how to connect what I currently have on my VI (the start and stop arrays) to the input of the subtraction node.

How do I connect the arrays to the input terminals of the subtraction node? Right now, there is no other terminal to connect them to the subtract node.

I apologize if it is very simple, I am very new to LabVIEW. Thanks so much!

Link to comment

Thanks for your help!

I am having trouble with how to connect what I currently have on my VI (the start and stop arrays) to the input of the subtraction node.

How do I connect the arrays to the input terminals of the subtraction node? Right now, there is no other terminal to connect them to the subtract node.

I apologize if it is very simple, I am very new to LabVIEW. Thanks so much!

Make sure the Auto-tool is on (on the tools-palette a green led should be lit), go to the right hand side of the terminal on the block diagram of an array, your mouse should turn into a wire-tool and you should see some small lines out of the terminal, click on the lines and your wire tool should be connected with a dotted line, now move to the subtraction node and perform the action on the input node.

Ton

Link to comment

I'm sorry to be so thick but when looking at my current VI (attached below) I have everything currently on there except the input to the subtraction node. I'm failing to see to where I should connect this input. Where on my arrays/loops should I attach into the input of the subtraction node?

Thanks so much!

third_practice_write.vi

Edited by newbie2
Link to comment

Take a look at the attached.

By wiring each individual value out of the For loop, you always have an array of the latest value written to your set of controls. This way, you don't have to read those values back out when you go to write the spreadsheet. When the While loop completes, it will pass out those latest values, which I wired into the subtraction node.

third_practice_write_asbo.vi

Link to comment

Duh! Thank you! I wasn't connecting the input into the subtraction node inside the for loop. Thanks so much!

However, when I run my VI with the correct connection, I get six zeros to write to the VI...did I need to change the form of the number in order to view it while in Excel?

Or is there a way to add a visual display to the front panel so at least I can double check that it is in fact computing the difference?

Why do I see 6 zeros when I open up the Excel file?

Thanks!

Edited by newbie2
Link to comment

Why do I see 6 zeros when I open up the Excel file?

Easy answer:

Because you save them (and it's not an Excel file, but a CSV-like file).

Long answer:

You should start debugging your application make sure you store the right values to Excel.

You see 6 zeros since you run your inner for-loops 6 times, the ouput of the for-loops is an array of 6 identical timestamps. Since you run the upper and lower for-loop in the same frame and you have no data-dependency they are basically (at least passed the 15 ms. windows accuracy) the same.

Your while loop does not autoindex, this means that it outputs the last array of 6 timestamps. These are save to the file.

Use Execution highlighting to debug your code, use probes and indicators.

Ton

Link to comment

Thank you for your help!

I am new to labview so your explaination kinda went over my head...

What should I change on my current VI inorder to see actual values instead of just zeros?? Will this execution highlighting be helpful to someone who is unfamiliar with labview?? I will try to go poke around and see what I find...

Again, thank you for your patience!

Link to comment
  • 3 weeks later...

If it makes you feel any better you are doing pretty well for a beginner.

Its tough, but only at the beginning. Once you "get it" you will be amazed at how much you can do with LabVIEW.

I will say though that you have to work pretty hard at finding out how to get the help you need from the help files in LabVIEW (which always assume architect level knowledge)

Contrary to Ni's assertion LV is NOT a beginner language or a non programmers language.

PS: You can best learn LabVIEW (I think) by looking at all the examples NI provides under help:Find Examples.

I personally think that is the best place to start when there is no clue at all and time is kind of short.

Most of what you need to find out is probably best shown by example.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.