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

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

分列读取文本文件

已解决!
转到解答

请教:我要分列读取文本文件,例如

column1       column2

 1                 8

 2                 5

 4                 2                                     

                                   

前面板上分别显示1 2 4

                         85 2

要怎么做?

0 项奖励
1 条消息(共 7 条)
6,388 次查看

从哪读?txt吗?

 

有个Read From Spreadsheet File.vi可以读txt

 

 

Thomas | Xi'an China

LabVIEW 7.1 | LabVIEW 2018
DAQmx | CompactRIO | myRIO
微信公众号: 钟博士LabVIEW工作室
2 条消息(共 7 条)
6,381 次查看
解答
已被主题作者 meiyan 接受

You may use Spreadsheet String To Array function to convert the tab-delimited text data into array, and with Index Array, Concatenate Strings and Format Into StringTranspose 2D Array and For-Loop etc to transform the data to the desired arrangement.

 

PS: it is assuming that the text data file is of tab-delimited

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
3 条消息(共 7 条)
6,379 次查看

With Thomas solution, all you need is Transpose 2D Array the 2D array output.

 

Just wire the transpose input of Read From Spreadsheet File to TRUE 😉

Message Edited by ian fung on 01-19-2010 03:35 PM
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
4 条消息(共 7 条)
6,375 次查看

哦,对,转置数组。

Thomas | Xi'an China

LabVIEW 7.1 | LabVIEW 2018
DAQmx | CompactRIO | myRIO
微信公众号: 钟博士LabVIEW工作室
0 项奖励
5 条消息(共 7 条)
6,370 次查看

i noticed that you use a "transpose to 2D array"to get a transposed array, but if the data is more than 2 columns,then how?

0 项奖励
6 条消息(共 7 条)
6,317 次查看

A Transpose 2D Array will transpose any 2D array with N-rows, N-columns.

 

More than 2 columns? It is, still, a 2D array, isn't it? 

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
7 条消息(共 7 条)
6,312 次查看