LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read data OSIRIS file

Hi.  

 

I would like to read data from Text File or OSIRIS file. 

I have to extract or use the data for the angle and also the first cycle in the file. Please refer to the attachment. 

I take a look on the example in the Find Example. However, it is not really helpful.

Apart from that, I tried to use Exress Read from Measurement File, however it is not working. 

 

Is there any other way or simple VI can read it?

 

Thanks.

0 Kudos
Message 1 of 7
(3,566 Views)

Fird wrote:

Apart from that, I tried to use Exress Read from Measurement File, however it is not working. 


Not working means, is there any error coming? Please post in bit detail. Also please post your vi. there maybe something wrong in the syntax. Post to help us to guide you better.

 

Thanks,

Mathan

0 Kudos
Message 2 of 7
(3,557 Views)

Since it is not in format of .lvm, eventhough it is in text file, thus I cannot extract the file using Read from Measurement file.

0 Kudos
Message 3 of 7
(3,554 Views)

Have a look at Read from Text File function.

 

And have a look at Write-Read Text File VI in the labview\examples\general\functions\File IO directory for an example of using it.

 

Post your VI with your attempt so we can help you resolve your issue.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 7
(3,552 Views)
The file looks fairly easy to parse.  I would recommend reading it all in at once (use Get File Size to get the length, then read it all into a single string using Read from Text File).  You can then parse it fairly easily using the functions in the String palette.  In particular, Match Pattern and Spreadsheet String to Array should be useful.  It is easiest to create a 2D array using Spreadsheet String to Array, then extract the portion you want from this array using Array Subset from the Array palette..  This will require more memory than parsing out a particular piece, but will be far easier.  Your file is fairly small, so this extra memory should not be an issue.  If you are not familiar with any of these functions, look at the examples for them before proceeding.  Good luck!  Let us know if you need more help.
0 Kudos
Message 5 of 7
(3,536 Views)

Hi DFGray,

 

Thanks  for the idea given.

 

However, I need more assistance to create this VI.

 

How to extract the portion I wanted from the file using the array subset. Could you give me example on this.

 

Thanks.

 

- New Learner of LabVIEW -

0 Kudos
Message 6 of 7
(3,495 Views)

Given the file you posted above, do the following:

  1. Read the entire file in (see my previous post for how to do this).  You should have a string containing the entire data file.
  2. Use  Match Pattern to find the text string "[Mean Cycle]".  This is the start of your data, but still contains the header information.
  3. Use Match Pattern twice more to find two end-of-lines.  The first will be the end-of-line after the text string we just found.  The second will be the end-of-line after the header information.  The remaining string will be your data.  To find the end-of-line, use the End of Line Constant from the string palette as the regular expression input.  Alternately, you can use "\r\n" or whatever is appropriate for your particular platform.
  4. You now have a string containing only the data.  Use Spreadsheet String to Array with format specifier %f to convert to a 2D array or doubles.  
  5. On the 2D array of doubles, use Array Subset to get the particular piece of the data you want.
Once again, consult the LabVIEW help and examples on exactly how each of these functions works.
0 Kudos
Message 7 of 7
(3,484 Views)