LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with ASCII text files - String to Array to Numeric - Confused

Hello,

I'm having a bit of trouble trying to read and analyze an ASCII text file from an instrument.

The basic idea (logic flow) of what I'm attempting to do is as follows:

(1) Open ASCII text file (Think I got this part correct)

(2) Convert it to a spreadsheet (Think I got this part correct)

(3) Search the spreadsheet array for a specific term (e.g. "Z (um)"); need the row index of this term. (No luck yet)

(4) Analyze the numeric values (not up to this yet)

So at present I'm having difficulties with the 3rd step...tried various array and string search vi's but haven't had any luck. In  the attached VI I was trying to trim the spreadsheet columns hoping that I could create a searchable 1 D array but my methods haven't worked.

Once I'm able to do this I will then need to analyze the numbers after the search term; thinking I'll need to convert the spreadsheet to an array of numeric values.

If anyone can offer some assistance it would be greatly appreciated.

I have ttached my current VI as well as the text file I'm trying to work with.

best

SS

Download All
0 Kudos
Message 1 of 11
(3,636 Views)
Why are you converting the string to an array?   I realize you want the index to it when found, but why?  You can also index inside a string..
 
There are no search functions in your code (either string or array search).
 
Also, you created a 2D array..  A 1D array would be better to search.. 
 
R
 
0 Kudos
Message 2 of 11
(3,613 Views)
I've made a couple of changes to your code.  Have a look if it is what you were looking for.  Use the "String to Search" control and experiment.  It supports both string search and array of string search.
 
R
 
0 Kudos
Message 3 of 11
(3,609 Views)
You text file is a combination of settings and some form of table. You need to provide a better idea of what you're trying to extract from this file. Do you just want the table? Do you want a specific column of this table?
0 Kudos
Message 4 of 11
(3,606 Views)

Good questions smercurio..

I just modded the original code to add the search feature.  I didn't grasp where this was going to...  😮

0 Kudos
Message 5 of 11
(3,602 Views)
Sorry for the confusion....
 
In Array Table in the VI the idea is to be able to search for a term (For instance "Z (um)") which appears at index 62,1.
These index values specify where the data is that I need to extract begins.
 
I then need to extract the numeric values below the "Z (um)" and "Delection (V)". In this file there are 1000 data points in each column, below the said headers, that I would like to have in a 1D numeric array so that i can run analysis on.
 
hope that makes more sense.
 
ss
0 Kudos
Message 6 of 11
(3,595 Views)
Any chance you could take a screenshot...I'm running LV 8.0
 
Yeah the search vi's turned up empty so I removed them from the one I posted.
 
0 Kudos
Message 7 of 11
(3,592 Views)

I then need to extract the numeric values below the "Z (um)" and "Delection (V)". In this file there are 1000 data points in each column, below the said headers, that I would like to have in a 1D numeric array so that i can run analysis on.

In that case a far simpler solution is to do the following:




Message Edited by smercurio_fc on 07-02-2008 01:33 PM
Download All
Message 8 of 11
(3,579 Views)

Ahhhhh.....very nice.

Works great. Saved me a lot of time.

Thank you very much!

0 Kudos
Message 9 of 11
(3,549 Views)

Hello

 

I have the same issue here, but the file to convert is this one attached.

 

The main difference is that the resulting array must be a char data array and not a numeric data one.

 

Victor

------------------------------------------------------
There is "No C" in spanish.
If you can think it, you can develop it.
0 Kudos
Message 10 of 11
(3,024 Views)