04-04-2011 03:57 PM
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
04-05-2011 03:20 AM - edited 04-05-2011 03:22 AM
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,
04-05-2011 01:31 PM
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.
04-06-2011 01:35 PM
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
04-06-2011 01:51 PM
Can datasocket help for this as a communication between 2 application?
04-07-2011 10:43 AM
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