LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read from excel

Highlighted
I have a problem trying to read data from excel spreadsheet.
In the spreadsheet i have columns with data of time, temperature, and density. Each datapoint of temperature and density belongs to a determined time. I want to read these data in pairs: (time - temperature; and time - density) and have them plotted on XY graphs as they are being read. And I want the pairs of datapoints to be read every 1-2 seconds. So, it'd give the impression that they are being "acquired" (by hardware) and plotted at the same time.
can anyone help me? I have some experience programming but i've never done this before with LabView.
Thanks a lot for any help.
Ursula
0 Kudos
Message 1 of 6
(1,584 Views)
Highlighted
Hi,
All you have to do is go through the labview basics 1 material else go and check out the help for the File I/O functions,read from spreadsheetfile.vi should do your work,else post again yuo will get lots of help.
cheers
vicky
0 Kudos
Message 2 of 6
(1,580 Views)
Highlighted
You should read the entire file in one read and then go over the array with delays.
Start by saving the file in Excel as a text file.
Then, you need to modify the VI Vicky mentioned to read strings (For some reason it doesn't). You can found instructions for how to do this on its block diagram (just place it in a VI and double click it. And don't worry, it's a simple change). Remember to save it under a different name.
Then, you need to convert the time string into LV time format. You can find a VI which will show you the basic method here.
Once you've converted the time, you can convert the rest to numbers and end up with a 2D DBL array, which you can plot. Have a look at the attached (7.1). I replaced the read part with an empty array and the conversion part with a case, but it should hopefully work. I may have also made a mistake in the way I built the graph. There is a shipping example which shows the proper way to build an XY Graph. Consult it if this doesn't work properly.
You can change the X axis to display time by right clicking it, selecting Format & Precision and selecting Absolute Time.

___________________
Try to take over the world!
0 Kudos
Message 3 of 6
(1,574 Views)
Highlighted
If your intent is really to read from Excel, take a look at the example called Write Table to XL. It opens Excel, opens a new workbook and writes a block of data one cell at a time. This example has 80% of what you need for a quick demo as you describe.

Changes you need to make:
1. Open an existing file instead of creating a new workbook (Workbooks.Open)
2. Read a cell instead of writing one (change Range.Value to read)
3. Separate the inner for loop into 3 separate reads (increment the column value)
4. Convert the variant into a string for date and a dbl for your values
5. Display the data on your graph
6. Add a time delay insite the for loop of 1-2 seconds

I suspect that you want to discard the date read from the file and substitute the current data and time if you want it to appear as if the data is being collected real-time.
Michael Munroe, CLD, CTD, MCP
Automate 1000+ VI Search and Edit operations with Property Inspector 3.2, now with Global Exclusion™ and Persistent Selection™!
Review the top 25 Impossible with LabVIEW Categories
Message 4 of 6
(1,555 Views)
Highlighted

Hi Gud mrng,

 

 

          I have problem with graph,I need read graph start time to end time in excel, when i give

time and date  means it show graph time period........how to slove my problem.

 

 

 

Regrads

Munna 

0 Kudos
Message 5 of 6
(1,004 Views)
Highlighted

I'm not sure who is the person "gud mmg" you are speaking to.

 

Your question is not very clear.  I'm also not sure exactly where Excel fits into the question.

 

I suggest you rewrite your question in more detail using clearer English and post it as a new message thread instead of replying into a 3 year old message thread.

0 Kudos
Message 6 of 6
(975 Views)