From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

read from text document to display into graph

Solved!
Go to solution

Hi,

I just started learning LabView a week ago and I'm stil new to it. I would like to display the data on the first(Greylevel) and third (Phaseshift) coloumn and plot it on a waveform graph. But I do not know how to connect it in the block diagram. And do i need to put in a property node for TimeStamp that displays ItemName and what does it do? I followed most of my diagram from the Read from Text file.vi. but i don't really understand how it works. Could someone please explain it to me? 

Also I'm using LabView version 9.

Please kindly tell me if i need to put in any other function to make it work or if I'm doing anything wrong.

Here's the text document, my block diagram and front panel:

 

0 Kudos
Message 1 of 13
(2,906 Views)

Exactly what are you trying to plot?

 

Your data has only 1 timestamp.  So a Waveform graph in the traditional meaning of a signal varying over time doesn't apply here.  You have a column of grey levels and a column of phase shift.  That seems more like an X vs. Y situation where an XY graph would be appropriate.  As such, the while loop isn't necessary.

 

You just need to use index array to get the 1st and 3rd columns, then bundle them in the appropriate way needed to send to an XY graph.  (The example finder has an example for XY graph that shows a couple of different ways of combining the data for different situations.)

0 Kudos
Message 2 of 13
(2,907 Views)

ok I see! 

So what's the timestamp for and how many should I put?

I've edited the block diagam. But should the output be 1D or 2D array? And am i using the correct bundle and am I wiring it correctly?

Here's the new block diagram:

0 Kudos
Message 3 of 13
(2,895 Views)

@LHX wrote:

ok I see! 

So what's the timestamp for and how many should I put?

 

I don't know.  Does the timestamp mean anything to you?  It is part of your data file, but doesn't seem to have much to do with the data in the file.  Who says you have to do anything with the timestamp.

 

I've edited the block diagam. But should the output be 1D or 2D array? And am i using the correct bundle and am I wiring it correctly?

Here's the new block diagram:


You didn't use an Index Array function to get your 1st and 3rd (or 0 and 2 indices.)

 

I'm not sure what you are doing with the Delete From Array.  That is the wrong function to use.

 

You may need to use Delete from Array to eliminate the header rows from your string array tha come from the data file.  Or read a number of lines from the file to get rid of that information before reading the rest of the file to convert to a 2-D array with the real data.

0 Kudos
Message 4 of 13
(2,865 Views)

I replaced the file dialog with a file path control cos I found it is easier for me.

ok so I've edited as you said and I tried to change the data output from index array from 1D to 2D using a reshape array function. But it is still 2D. What did I do wrong?

Edited block diagram and front panel:

 

Download All
0 Kudos
Message 5 of 13
(2,849 Views)

Where did I ever say to use Reshape Array?

 

Please reread my message and note that I said to use Index Array.

 

Read what I said and implement it.  If you still don't get it, attach the VI rather than an image.

0 Kudos
Message 6 of 13
(2,847 Views)

ok sorry!

Here's my VI:

0 Kudos
Message 7 of 13
(2,842 Views)
Solution
Accepted by topic author LHX

And here is the modified VI based on what I described.

0 Kudos
Message 8 of 13
(2,833 Views)

ok thanks! But why is the count 12? can it be other numbers as well?

0 Kudos
Message 9 of 13
(2,828 Views)

I was getting rid of the first 12 lines of the file that are related to the header info.  If you do less, than text will confuse the conversion to values.  If you read more than 12, then you will not get the first real data points.

 

Try experimenting.  Change the number and see what happens!  That is the way to learn.

0 Kudos
Message 10 of 13
(2,825 Views)