LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read/Writing Spreadsheets to labview memory Please Help!

Hey guys,
 
                  I really need some advice or examples or pretty much any help I can find in trying to get these functions to perform correctly.  (these two functions are found within the main file) data_write is meant to read a spreadsheet file then write it to labview memory, or to memory with in the device it will later be hooked up to, and data_read is meant to read this memory, or what would be returned from the device, and then write that data into a new spreadsheet.  So at this point if it was able to create the same spreadsheet it initially read then it's working perfectly.  All the DAQ stuff really confuses me, and I've looked at these files so many times I feel like I'm running in circles.  I'm on an insane time crunch and I would really appreciate any help especially examples to drag me out of this hole.  If anyone could alter the existing code to make those read write functions I would be overwhelmingly grateful.  Thank you all so much.
 
Philip
0 Kudos
Message 1 of 24
(4,427 Views)

Hi, Philip!

Let me see if I got it right: You simply want to keep this spreadsheet data in memory in order to manipulate it somehow while the program runs and then write it to a new spreadsheet file later on? My screen resolution is very poor and your files filled something like 10 screens when I opened them so I gave up getting the overview.

If I'm right in my assumption there are many -and quite simple- ways to do this depending on what kind of data your spreadsheet file contains and to what extent you want to manipulate it. What about a simple array or cluster of arrays? If you put them in a sub-VI it has the nice quality that even if you have multiple instances of it on your block diagram (configured to read or write) they all reference to the same array in memory. They can also be adapted to fit virtually any specification (what kind of data to save: 1D, 2D....,) Once you're ready to write to your new spreadsheet file you simply dump the contents into it.

The principle is used in any standard buffer, and LV has a couple of example codes (search for "buffers"), but these are actually much more complicated than what I'm thinking of. I've attached a "suggestion VI" made in LV7.1 that stores an array of strings and a 2D array of doubles which are replaced each time you write to the VI. This might not solve your problem, but perhaps it will point you in the right direction.

Regards, Einar

 

Message Edited by einarsto on 05-28-2006 10:39 PM

Message Edited by einarsto on 05-28-2006 10:40 PM

Download All
0 Kudos
Message 2 of 24
(4,421 Views)

Thanks alot for the reply!!  My main area of confusion is the DAQ parts of the program, If you look at those data read/write files you'll see what I'm talking about.  This is a project someone else started and I've kind of been brought in to finish.  If you could, take a look at "data_write.vi" within that first big .llb file, maybe you can shed some light on this mess.  Thanks again!

 

Philip

0 Kudos
Message 3 of 24
(4,408 Views)
Hey again,
 
                  Can anyone offer an example of writing a spreadsheet into virtual memory, using digital I/o functions??  I'd really appreciate anything.  Thanks alot guys!!
 
Philip
0 Kudos
Message 4 of 24
(4,406 Views)
Hey Philip!

I would recommend giving us some more information about what problems you are having.  Are you getting errors?  Or are you just looking for suggestions?  What specifically are you having problems with?  I also wanted to get a general overview of what it is you are doing just to make sure that we are on the same page.  You would like to take a spreadsheet that you have on your computer and be able to read that into LabVIEW, then translate that into a form that is able to be written using digital I/O, then you would like to ouput this data using a DAQ card.  Is that correct? 

Please repost with any corrections to my description of what you would like to do, and some additonal information about your program.  There are a ton of examples for DAQmx for digital I/O and for reading spreadsheets in LabVIEW.  Thanks!

Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 5 of 24
(4,393 Views)
Hey Andy,
 
              Thanks alot for the reply!  Your description is exactly right, that's precisely what I desperately need to accomplish, if you could post examples or forward me to some I'd be extremely appreciative!!  Thanks again!
 
 
Philip
0 Kudos
Message 6 of 24
(4,382 Views)
Philip,

You have a couple of options for reading in Excel data.  The first and easiest would probably be to save the spreadsheet as a tab delimited text file, which you can read in LabVIEW directly using the Read from Spreadsheet File VI in the File IO palette.  If you would rather keep the Excel format then there are a lot of examples about interfacing with Excel from LabVIEW, which can be found at this page.  Once you have the data into LabVIEW, I would convert them to a numeric array (if necessary) then into a byte array.  If you search you can find a Decimal String to Number and a Number to Byte Array function.  I am not sure about the timing, etc. that is necessary for you device, but if you open the Example Finder and search for digital you will see a lot of examples (I would recommend using the DAQmx examples).  Exactly which one will be up to your requirements. 

Post more information about your application or specific questions if you want more info!
Andy F.
-----------------------------------------------------------------
National Instruments
Message 7 of 24
(4,369 Views)
Andy,
 
          Thanks for the comments!  At this point in the project all i need to do is read a spread sheet file that is written in hexidecimal, write that data into labview virtual memory, that data would then be sent to the protoboard I'm working with and changed somehow, I would then need to read labview virtual memory and write that data into a new spreadsheet.  So basically if the data was not changed/ i.e the protoboard not attached then a spread sheet identical to the initial one would be created.  I'm having a really hard time finding example code! idk if the ni website it having troubles but I keep running into dead ends and have not been able to see a single picture of example code performing a similar task.  Thanks again and example code would be a life saver!
 
Philip
0 Kudos
Message 8 of 24
(4,357 Views)

Anyone have some insight on the topic, I'm getting really pressed for time trying to get this part workin.  Thanks everyone!

 

Philip

0 Kudos
Message 9 of 24
(4,341 Views)

Philip,

Unfortunately for such a specific topic there isn't going to be a complete example that does everything that you need it to.  However, I believe that if you check the resources that I gave in my previous post you will be able to do everything that you need with example code modules.  For example, if the spreadsheet file is saved as a tab delimited text file you can use the Read from Spreadsheet function to read that information into LabVIEW.  This will output an array of strings, which you will need to convert from a hexadecimal string to a number and then to a Boolean array, which the Hexadecimal String to Number and Number to Boolean Array functions will accomplish.  Once you have Boolean Arrays you can write those arrays using the DAQmx examples.  Write Digital Line or Port should do the job.  Once you have done this you can reverse the entire process and read the information from the proto board, convert that into numbers and then compare the previous and updated values to determine if you need to rewrite the file. 

I would be glad to help out more if you had specific questions about errors or problems you are having when implementing your application. 
Andy F.

-----------------------------------------------------------------
National Instruments
0 Kudos
Message 10 of 24
(4,332 Views)