LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read data from file fro HP4192A

Solved!
Go to solution

Hi,

I am trying to read from txt file some frequency values. but it counts that as a sum of character. for example; 1500000 in the txt file is read to be 7. what can I do? I attached my vi file and txt file. Thank you ver much.

 

Download All
0 Kudos
Message 1 of 13
(4,424 Views)
What you are doing does not make any sense. If you want to read a specific row, you would not use the 'mark after read' output. Did you read the description of that? Wiring up the row doesn't make much more sense unless it is just the first element you want to use as an input. You can use the 'all rows' output and use the Index Array function to get a specific row. If you want to pass each row to the instrument, then you would place a for loop around the instrument code and have the Read From Spreadsheet outside the loop and wire the 2D array into the for loop so that it will auto-index each row.
Message 2 of 13
(4,413 Views)

Hi again,

I am so sorry. My programming is bad as well as my english. I can not understand so clearly. I wired Read From Spreadsheet to Index Array. It reads only first value from txt (or xls) file. I couldn't connect in a "for loop" or a "while loop". so it doesn't read the other rows. I added the VI file. how can I make read the all rows automatically. thanks again...

 

0 Kudos
Message 3 of 13
(4,375 Views)

I don't see where you have tried to do anything.

 

Here's the simple modification I was talking about. I also changed the Write to Spreadsheet so that it would not create a new file each time.

 

Loops and arrays are fundamental concepts in any language. I would suggest you spend some time with the free tutorials.

Message 4 of 13
(4,347 Views)

Thanks Dennis for all of your advice. I read that site carefully. But you know that my English is not so perfect. I successed to use Read From Spreadsheet. But I can not use Write To Spreadsheet function same time. I think I am right way and I think I will stop to disturb you any more, soon. I added the revised file again. please, tell me where my mistake is, and how I can correct this problem. Thanks a lot again. good luck

 

Download All
0 Kudos
Message 5 of 13
(4,327 Views)
I guess the attachment got lost. Here it is. Much simpler than your last example since it only reads the file once.
0 Kudos
Message 6 of 13
(4,322 Views)

Hi,

Thank you for every thing. The vi file you added works fast. but some values of frequency have being repeated and some of those have not being read. I added the vi file, read.txt and write.txt. Please compare read and write files (the third column in the write file). both read.txt and write.txt have 57 values. I think the program is too fast to read the response. what can I do to solve this situation. thanks again. good luck.

 

Download All
0 Kudos
Message 7 of 13
(4,276 Views)
I never looked at the command string you are trying to build until now. There is a problem with that. You have a '%' as the first format string. this does nothing. There is a 'FR%.4fEN'. this takes the value from the text file. Then there is a 'OL%.3fEN'. this has nothing to format so the same thing is sent to the instrument and I'm sure that it is an invalid command.
0 Kudos
Message 8 of 13
(4,235 Views)

Hi,

 

Denis is right there is no problem of reading now (just look what you are reading and you will see there is no error). Just put some Probe to see what are you reading from your instruments and if what you obtain after your String to Fract/EXP is good or not (certainly not ). Use probe or put indicators to see if you receive good answer from instruments and if your conversion is good or not.

Why the program will be to fast if you wait for RQS ?

 

Regards

Greg S.
CNRS
LV 7.1 8.2 8.6 2009 2011 2012 2013 2014
LPMC - CNRS
N'oubliez pas de complimenter cela fait toujours plaisir.
0 Kudos
Message 9 of 13
(4,225 Views)

It works better in average mode. The program have measuring twice some frequency inputs in this sitution, rarely. Measurement doesn't carry out when I was remove '%' at the first command string.Likewise there are some problem when I was remove/change 'FR%.4fEN' and/or 'OL%.3fEN'. Additionally, always there is last result of measurement or zero at first line in new measurement, in spite of I reset instrument and computer manually or I added GPIB CLR function to program as a first command. I added some probes and indicators but the same problem have going on.

I attached the last states of program and read-write files.

Thank you so much for meritorious help.

Download All
0 Kudos
Message 10 of 13
(4,183 Views)