LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read excel file

I am creating the labview program to compare the values of mediatation and attention in array. If either the value of mediation or attention hits 100, it will compare the values of both mediation oand attention. The mouse will move in the direction of up when mediation is larger than attention. On the other hand when the attention value is larger then the mediaiton value, it will check the range of the mediation values where in falls to control the mouse to move, right, left or up. However when I try to input the file and run the program, there is this pop up as shown in the attachment. Can anyone tell me what would be the possible that gone wrong in my the wiring connection. Thank you

Download All
0 Kudos
Message 1 of 5
(3,538 Views)

Is your path pointing to an XLSX file or a TXT file?  Read From Spreadsheet File does not actually read from Excel.  It needs a CSV text file, which stands for comma-separated values.  . 

aputman
0 Kudos
Message 2 of 5
(3,515 Views)

In addition to possibly meaning Excel (i.e.  a file with the extension .xls or .xlsx) and trying to use LabVIEW's File routines for CSV files (many people mistake the word "Spreadsheet" to mean "Excel"), your code is confusing, hard to understand, and (therefore) hard to be sure it is "doing what you want".  Here are some suggestions:

  • Make a sub-VI  that takes a "Move" cluster and two other inputs and does the "Set Cursor Position" stuff.  Among other things, this will replace these segments that have wires running all over the place with a single 32-by-32 pixel Icon.  You could even get rid of the Case statement by including a Boolean input (put the Case inside the sub-VI).
  • "Edit" (or "Cleanup") your Block Diagram.  Get the wires running as straight as possible, left-to-right (never backwards).
  • Do you really have 4 variable Move Up, Move Down, Move Left, Move Right controls?  Will they vary?  If they are constant, you can simplify things even more by having an Enum "Direction" (with values Up, Down, Right, Left) that serve as the inputs to the sub-VI mentioned above.

I'm curious what the Data look like.  If you reply, consider attaching a data file.  Among other things, it will clarify what you are trying to do, and can make our responses more "relevant".

 

Bob Schor

0 Kudos
Message 3 of 5
(3,507 Views)

Hi Bob,

 

I had change the comparison output into binary as attached for comparison and also the spreadsheet that holds the data. However the labview state that there no case for selector value. Kindly please advice. Thanks

Download All
0 Kudos
Message 4 of 5
(3,437 Views)

huihan26 wrote:  However the labview state that there no case for selector value. Kindly please advice. Thanks

That is because you did not allow a case for every possible integer value.  The simple solution would be to turn your 0 case into Default.

 

But that code can me made simpler.  Did you know that a case structure can do ranges?  So instead of doing the comparisons, let the case structure do it for you.  I see cases being "Default", "50..59", "60..69", and "70..".  The ".." is what allows for the ranges.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(3,415 Views)