LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from table

Hi,

Could someone quickly show me how to read from a table and write to a file? and read from a file, write to a table in labwindows?

 

Thanks.

 

Brigit

0 Kudos
Message 1 of 6
(3,440 Views)

Hi Brigit,

 

The quickest method would be to use GetTableCellRangeVars to read the values into an array and then use the ArrayToFile function to write them to a file.

 

ArrayToFile handles all file operations internally. No need to manually open/close the file. Just give the file path and it is there.

 

For the inverse operation the required functions are FileToArray and SetTableCellRangeVars.

 

Hope this helps,

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 6
(3,427 Views)

Hi Eren,

 

Thanks. Another quick question: is it possible from a separate C running program to send data to a labwindows interface table. I need to have a labwindows interface running (with table) and a c program write that produce data to be writen to the labwindows interface table. Is this possible? any help?

 

Brigit.

0 Kudos
Message 3 of 6
(3,413 Views)

Brigit,

 

There are quite a few options for communicating between different processes, if the c program and the interface program you are writing need to be separate.  If they can be combined, then you can pass the data between the different functions through parameters, which would be more straightforward.

 

If the programs must be distinct, you can pass data by writing and reading from a file.  This does not require any particular environment, but it will be relatively slow and you will need to make sure you protect the file from both programs trying to access it at the same time.

 

If both programs can be written in CVI or another National Instruments environment, there is a tool called Network Variables that allows you to post and read data across different programs.

 

Hope this helps,

 

Jen W

Applications Engineer

National Instruments

ni.com/support

0 Kudos
Message 4 of 6
(3,395 Views)

Can datasocket help for this as a communication between 2 application?

0 Kudos
Message 5 of 6
(3,392 Views)

Agyna,

 

Datasocket is another option, but generally network variable is a little better choice.  For some information about the two in the context of .NET, take a look at this article: Migrating to Measurement Studio Network Variable from DataSocket

 

Hope this helps,

 

Jen W

Applications Engineer

National Instruments

0 Kudos
Message 6 of 6
(3,373 Views)