LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving to Spreadsheet File

If this table is formatted in this manner all of the time, then you can read the file as a multi-line string, look at each line individually, and pick out the value that you need.  It is somewhat crude and it requires that you maintain this constant format to work.  Any changes to the file format can cause this vi to halt.
Message 11 of 25
(1,688 Views)
If I go through the example labelled 'table read' and I use the pick line function to always read the first two lines, is there a way so can scan for particular words instead of just by line.  For ex.   If I want to scan the table for 'Set Battery Voltage' and record that value, but 'Set Battery Voltage is never on the same line in all tables.  How can I go by selectign that?
0 Kudos
Message 12 of 25
(1,546 Views)
OK, we should focus on one problem at a time. This thread drifted from writing two tables to one file, to intiailizeing arrays, to picking a certain line out of a string.
 
Do you have a real table (=2D array of strings) or just an ASCII string made to look like a table by using seperators and linefeeds?
 
You just need to search for the desired patterns, and parse the immediately following characters on the same line. The example given by tuned99 is not that great, because it duplicated a lot of code that could be done in a loop. It will also fail as soon as the lines are changed, e.g. if an empty line is inserted at the top of the string.
 
Attached is one possibility. I would place the full set of output elements in a cluster. Inside a loop, parse each line and rewrite the desired cluster element.
There are many ways to do this.
 
(I only parse three elements, add the rest as needed, LabVIEW 7.1)
 
 
Message 13 of 25
(1,657 Views)
In altenbach's example parse elements........Just like there is a LED for Auto-Compensating and it lights up whenever it is ON, I would also like for there to be a LED for Torque.  Whenever Torque 1 is used the LED lights up and whenver Torque 2 is used I would like the the LED for Torque 2 to light up.  How can I add that to the diagram.  and also I would like the the values of the Torque 1 and 2 to go into numeric indicators.  How can I do all of that?
0 Kudos
Message 14 of 25
(1,528 Views)
Is it possible to save a cluster as a spreadsheet file?  would I have to change it to an array first, then to a spreadsheet file?
0 Kudos
Message 15 of 25
(1,523 Views)
Just follow the pattern I outlined:
  1. Add new elements to the cluster diagram constant for each desired output, give them reasonable names and desired default values.
  2. Add keywords for each element to the "keywords" string array constant.
  3. Add new cases for each keyword. The case number will correspond to the index in the keyword array.
  4. For booleans duplicate case 0, and for numerics duplicate case 2. For other types, create suitable case code.
  5. Delete the current FP cluster and make a new one (right-click on the output shift register..."create indicator").
  6. Voila!

Modify as needed. Good luck!

Message 16 of 25
(1,519 Views)
altenbach, I did all you said, but what if I want to only select certain words out of the string.   ex. What if for 'Set Torque 1 to 3.5', I only want the word Torque and from that if it is Torque 1, I want the Torque 1 LED to light up and if it is Tourque 2, I want the torque 2 LED to light up.
0 Kudos
Message 17 of 25
(1,514 Views)


@Pondered wrote:
Is it possible to save a cluster as a spreadsheet file?  would I have to change it to an array first, then to a spreadsheet file?

Don't complicate things, LabVIEW ie easy!

You cannot convert this cluster to an array, because it has elements of different type (booleans and numbers). Just unbundle it all by name and format it as desired.

Message 18 of 25
(1,514 Views)
How can I select a specific character out of a token string?
0 Kudos
Message 19 of 25
(1,508 Views)


@Pondered wrote:
How can I select a specific character out of a token string?



It is not clear what you mean by "specific character", but all the string tools are available in the strings palette.

  • Do you want to know what character is at a specific position?
  • Do you want to know at what position a specific character occurs in a string?
  • Do you want to know if a specific character occurs in a string or not?
  • What is "select"? (Highlight it in the original string, write it to a different indicator, etc.)?
0 Kudos
Message 20 of 25
(1,504 Views)