From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open and select specific values in a file

Solved!
Go to solution

Hello,

 

In my project, I need to open a file that I create with the VI "write to text file".

The file contains 3 columns :

Naxmouk_0-1594196349198.png

What I want to do :

I would like to be able to select the start and end date of the data I want to show.

For exemple : I only want to see the data from 08/07/20-09:07:16 to 08/07/20-09:07:20.

I know that I need to use the VI "Read delimited spreadsheet", but I don't know how to make a user friendly front panel.

I don't want the user to have to select the line number, but rather to indicate the start and end date of the data he wants in the front panel.

 

"read" is my attempt to use Read delimited spreadsheet.

"testheaderv2" is the program that creates the file.

 

Thank you !

Download All
0 Kudos
Message 1 of 15
(2,602 Views)

Hi Naxmouk,

 


@Naxmouk wrote:

I know that I need to use the VI "Read delimited spreadsheet", but I don't know how to make a user friendly front panel.

I don't want the user to have to select the line number, but rather to indicate the start and end date of the data he wants in the front panel.


Unfortunately you saved your VIs using LV2020, which I cannot open right now. So you get just a textual description of your task…

 

Simple steps:

  • Read the file using ReadDelimitedFile as an array of strings.
  • Convert the first column to an array of timestamps.
  • Convert the other columns to numeric values.
  • Have two timestamp controls on your VI to define start/end of the range of interest.
  • Search the timestamp array for your start and end timestamp to get the corresponding row numbers.
  • Use the row numbers to select subarrays from your numeric data.

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 15
(2,588 Views)

Hello GerdW,

 

Thank you for your reply.

Here are my VIs under LBV17

Could you please show me an exemple of what you said ? I'm kinda new to Labview

 

Thank you in advance !

Download All
0 Kudos
Message 3 of 15
(2,575 Views)

Hi Naxmouk,

 

here's an example showing the first steps:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(2,565 Views)

Thank you very much !

Could you please link me the VI ?

0 Kudos
Message 5 of 15
(2,553 Views)

Hi Naxmouk,

 


@Naxmouk wrote:

Could you please link me the VI ?


Sorry, didn't save the VI.

But the functions are pretty clear to recognize…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 15
(2,547 Views)

Re-Hello GerdW,

 

I'm really sorry I'm new to Labview so I never used those VIs and I can't find them :

Naxmouk_0-1594204231112.png

I did not understand the loop and the while part.

The array subset is used to select the column 1 and 2, and the array index is used to select the column 0.

If I understand the "for" is used to convert my string time stamps into real timestamps ?

For the while part I don't understand what it's doing.

0 Kudos
Message 7 of 15
(2,537 Views)

Hi Naxmouk,

 


@Naxmouk wrote:

I never used those VIs and I can't find them :

Naxmouk_0-1594204231112.png

ScanFromString to convert a string into a numeric datatype (or timestamp in this case)…

Threshold1DArray to search in an sorted 1D array. I just notice I forgot to wire the array data to this function…

 


@Naxmouk wrote:

I did not understand the loop and the while part.

If I understand the "for" is used to convert my string time stamps into real timestamps ?

For the while part I don't understand what it's doing.


You recognized the FOR loop intention correctly: convert an array of strings to an array of timestamps.

The while loop is the loop handling your UI, waiting for user interaction with those timestamp controls.

 

Please note my "rough idea" is missing the whole error handling!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 15
(2,525 Views)

@GerdW wrote:

Hi Naxmouk,

 

here's an example showing the first steps:


Does this account for daylight saving (if applicable)?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 15
(2,522 Views)

Hi Bill,

 


@billko wrote:


Does this account for daylight saving (if applicable)?


When you want to avoid any DaylightSaving hassles you should store timestamps as UTC data (also when converting to string).

I guess the OP didn't care about that when creating the data text files…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 15
(2,509 Views)