LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract data from a file?

o to all labview users.

I am currently learning labview to control the network analyzer hp8720 as part of my project. Through my program, i am able to do a sweeping function with my NA and the sweeping data are written to txt file. and i want to extract the db value corresponding to a specific frequency.

my txt file is like the following:

MHz   dB
103     0.015
168     2.09
201     2.67e01

I know that we can extract certain selected data by using the some palettes like "read file" and "scan file"

I tried using "scan file" and i couldnt extract the data(ex: the dB value corresponding to 168MHz) i want successfully....i checked the help file and did put some syntax in the format string like (%[^2.09]), but it seems the "scan file" palette was only able to scan the first line, which gave me "Mhz db".....
is the format of my txt file not correct?

also, i tried using "read file" palettle..and i set the count to "-1" to read the whole file. someone suggested on the forum that it is easier to read the whole file and then use array to extract the selected data.

How can i write to the array using "read file" while specifying the what range of data i want?

Instead of doing that, maybe i can just simply write the db value related to the specific range of frequency while the program is in a while loop doing sweeping?

It would be greatly appreciated if someone could me some guidance.

thank you very much
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 1 of 9
(2,933 Views)
Your question is a bit confusing. At one point you say you want to read a file and then you ask how to write to the array. If you use Read From Spreadsheet File, the entire file can be loaded into a 2D numeric array. To find a db level corresponding to a frequency, this would be reading the returned array and not writing to it.
Message 2 of 9
(2,923 Views)
ic, thx for the info 😃

and about using the simple "read file" block, is it possible to use that and the output to be written into an array?

and for "scan file" block, i was only able to make it read the first time, otherwise, i kept getting the "scan failed" error. Is my txt format wrong?

thx again for the help
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 3 of 9
(2,917 Views)
If you use Read File, you will get one long string. You would then have to convert this yourself to an array. One way would be to use Spreadsheet to Array. Read From Spreadsheet has this function in it so it doesn't make much sense to me to re-create a function that is already on your palette. In order to use Scan From File, you would need to create a format string that would include all fields and all lines in the text file if you wanted to read the entire file. This doesn't make much sense to me either.
Message 4 of 9
(2,910 Views)
i see

i get it now 😃

thx very much for your detailed explanation. it is a great help 😃

thx
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 5 of 9
(2,878 Views)
Hi, I have been reading this post It is very interesting and also I need help. I am doing a project involving scattering matrix (S parameter) using frequency and time domain analysis. In order to make use of S parameter in frequency domain from Vector Network Analyzer, I need to convert S parameters from frequency domain (sweep from 8.2 GHz to 12.4 GHz) to time domain using inverse chirp z transform or any. I have no idea how to implement it. Could you please help or guide me how to implement them. I am using Labview 8.0 and matlab. Please see the attached file for the data in frequency domain both linear , dB magnitude and phase.
Thank you so much for any help.
Tantong
0 Kudos
Message 6 of 9
(2,854 Views)
Hello Tsu Tan

it is bad form to repeat requests on different threads Smiley Mad

Start a new thread if the subject is not salient to the disscussionSmiley Happy

With regard to your request have you actually looked in the NI examplesSmiley Wink

Open the NI examples, check out : Relative Absolute Frequency Time  that should get you started.

Regards

xseadog
0 Kudos
Message 7 of 9
(2,847 Views)
Hi,
        Thank you so much for your advice. After I open the Relative Absolute Frequency Time, it said
This vi demonstrates how to create a DIAdem report with different
time-domain (relative, absolute) and frequency-domain signals.

Directions:
1. Run the VI.
2. A report will be generated with three signals
    with differentx signals (relative/absolute time
    and frequency).

*Note: NI DIAdem 9.1 Service Pack 2 (or higher) and
Adobe Acrobat Reader are required to run this example.
You can reconfigure the DIAdem Report Express VI to "Printer"
or "HTML" output if you don't have Acrobat Reader installed.

Three plot results are shown below
0 Kudos
Message 8 of 9
(2,841 Views)
So

??

What is your question now

xseadog
0 Kudos
Message 9 of 9
(2,824 Views)