NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

用什么 样的loop来实现重复不断的 读同一个文件里的数据

如题,我可以按顺序显示文件中的数据,当读完最后一个数字,怎样可以让程序返回数据第一个接着重新读数据。
0 项奖励
1 条消息(共 9 条)
5,157 次查看

meiyan wrote:
如题,我可以按顺序显示文件中的数据,当读完最后一个数字,怎样可以让程序返回数据第一个接着重新读数据。
What kind of data file you are reading? Why do you need to keep on reading the file?
 

 

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
2 条消息(共 9 条)
5,156 次查看
Could you use a While structure? And connect a Boolean control to the loop condition. You could set that your file is read while Boolean is true and stop reading the file by making boolean false.
0 项奖励
3 条消息(共 9 条)
5,133 次查看
高兴表情tab_delimited value.it is required to keeping looping,i have no choice难过表情
0 项奖励
4 条消息(共 9 条)
5,124 次查看

So, you have a tab-delimited values file, and you want to read and display them one value at a time? till the last value. Then, repeat the same? Does the values change? If so, when does it changes?

 

How about reading the file once, convert the tab-delimited values to array, passing the array to a for-loop, auto-index the array to display the elements (values) one at a time. And, repeat.

 

As of how to convert tab-delimited data to array, please read this thread

 

If not, please kindly describe in detail about what exactly you want to do with the file and its data. ya. 

Message Edited by ian fung on 02-03-2010 11:49 AM
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
5 条消息(共 9 条)
5,122 次查看

i have a tab-delimited values file, and i want to read and display them one value at a time till the last value. Then, repeat the same. 

Do you think there will be a way to let it like ,after reading all values ,it wait for a while,when there is no new values come inside the file ,it repeat the same file value,if there is new value come inside the file ,it continue updating the new value? 

 

0 项奖励
6 条消息(共 9 条)
5,118 次查看
可以用Get file sizeGet file size.PNG节点来判断文件是否有new value,进而做相应的动作。
0 项奖励
7 条消息(共 9 条)
5,099 次查看

Hi Meiyan,

 

The attached reference code is coded in consideration of the tab-delimited file cannot left opened during displaying of data since your (data) producer might be updating the file. Hence, Read Characters From File is used.

 

Please also take precautions at when the code is reading the data file as your (data) producer might be updating the file at the same time frame.

 

I am not going to explain what the code does here, please take a look at the block diagram (and remarks).

 

PS: This code is a very rough one and it is for reference purposes. Hope you may modify to suit your needs 😉 You may try enter new data and save them during display's runtime...

Message Edited by ian fung on 02-03-2010 02:44 PM
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
下载全部
0 项奖励
8 条消息(共 9 条)
5,092 次查看

关键是判断“读完最后一个数字”。我记得LabVIEW读取函数一般有个“EOF”输出(像TDMS Read和读取

 

测量文件Express就有“EOF”的输出),如果读完了最后一个数据,EOF就会返回逻辑值1,否则返回0。你

 

可以利用while循环或事件结构来查询“EOF”的输出逻辑值,从而实现“让程序返回数据第一个接着重新读数

 

据”的目的。

Best Recards,

Shade
0 项奖励
9 条消息(共 9 条)
5,046 次查看