LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare Excel Workbooks in Labview

I'm not going to just list all the things that you should do 1 by 1, but try this as a starting point for learning how to do it yourself:

 

1. Delete ALL of the local variables you're using now.

2. As replacements for them, either use the control or indicator wired directly in, instead of leaving them all outside of the loop doing nothing, or just use a wire.  Remember that you can split a wire into as many different input terminals as you need, but it can only hook up to one output terminal.

3. If there's a value you want to set at the beginning, either use a constant on the block diagram, or wire a control to it.  To set the value of a control, either input it in manually before running the VI or set the value you want it to always start as the default value (find the control on the front panel, right click, data operations, make current value default)

0 Kudos
Message 11 of 12
(917 Views)

Wow.  This is quite an ambitious "first attempt at LabVIEW" project.  While it can be a "good thing" to have a task in mind when learning a new Programming Language, this particular task, and for this particular language, might not be an optimal pairing.

 

You've already been given good advice about learning the idea and nature of Data Flow, and that Local Variables (in LabVIEW) are generally the wrong way to do many things (shift registers are better ways of handling "local" data, usually).  You also need to learn to think in terms of "larger concepts" (which you can encapsulate into sub-VIs).

 

I think your first order of business, assuming you really want to do this ambitious project yourself (as opposed to hiring someone to do it for you) is to spend a few hours watching as many "Introduction to LabVIEW" Tutorials that you can find (there are quite a few on the Web).

 

Some specific things I noticed on your latest code effort (besides the fact that it sprawled over a lot of screen real-estate, and had no sub-VIs), include:

  • The Report Object wire (looks like a chain) for both Reports branches!  This should (almost surely) never branch, but run from function to function, from New Report to Dispose Report.
  • As I understood your problem, you want to compare "like to like", i.e. compare identically-named Worksheets and, within a Worksheet, identically-named rows (or columns, I forget which).  I don't see this logic anywhere in your code.
  • If this is what you want to do, spend a few minutes/hours without LabVIEW, but with pencil (or pen) and paper, just writing high-level code that says what (not how) you want to do.  For example:
    • Open Workbook 1.  Make a list of all the Worksheets.
    • Start with Worksheet 1.  See if this Worksheet exists in Workbook 2.
    • If both exist, start processing the columns of Worksheet 1.  See if there is a corresponding column (by name, not position, unless position is what you want) in Worksheet 2.
    • If you have corresponding columns, compare them row-by-row.
  • Some things are missing in this simple pseudo-code.  For example, what do you want to do if Workbook 1 has Worksheet 1, but Workbook 2 doesn't?  How about the inverse -- I'm using Workbook 1 as the "Master", but suppose Workbook 2 has a unique Worksheet?  A similar question might be asked about columns.
  • If you attempt to write such a logically-complex task as one big Main VI, you will have an almost hopeless tangle of wires and functions that almost noone will be able to follow and that will be almost impossible to debug.  You need (seriously) to break it down into "larger concepts" encapsulated in sub-VIs, probably nested at least 4-6 layers deep (a guess off the top of my head).  As a hint, the Top Level program should have a block diagram that will occupy no more than 50% of a laptop screen, with a bunch of little 32-by-32 pixel sub-VIs, joined by wires, handling the details for you.

Bob Schor

0 Kudos
Message 12 of 12
(908 Views)