LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to work with arrays when building a CIN?

Hi,
I need to develop a CIN which takes in 1 3x3 array along with a couple of doubles as inputs and outputs one 3x3 array. I am completely fine with building the block diagram in LabVIEW and generating the .c file, the problems begin to occur when I need to handle the input data inside the function! I have no idea how to access each particular element of the array!?!? The input parameters show as something like this : TDIhl(this might be mispelled) Array1, ...Array2... and so how would I access say element in row 1 column 2 of Array1??? Is there any array functions to use with a CIN? Please as much help will be appreciated,
0 Kudos
Message 1 of 4
(2,738 Views)
Why do you need a CIN? Can't it all be done in LabVIEW?
0 Kudos
Message 2 of 4
(2,738 Views)
The code is written in C. There are alot of complex manipulations of the input data (data conversion, math equations, etc..) I have code in C so it's alot easier for me to try to adjust the code to fit the labview data types vs. I'm not even sure what? I am just a beginnner when it comes to LabVIEW. So please humor me and answer my original question,
0 Kudos
Message 3 of 4
(2,738 Views)
For an array with "r" rows and "c" columns, you can access the element at row "i" and column "j" as follow:

value = (*array1) -> arg[i*c +j];

For more information, check the document "Using External Code in LabVIEW", which should be included with LabVIEW. You can download the document also from www.ni.com at:

http://digital.ni.com/manuals.nsf/web_productcurrent/4F1447F7CD83D6D88625690D00637CED?OpenDocument

Also, check the following example at the developer zone:

Replacing a Portion of an Array
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&3B5B43568CF83D948625683A000C397E&cat=71359FBAD517F4CB862567E0007B6F6E

Best regards;
E. Vargas
www.vartortech.com
0 Kudos
Message 4 of 4
(2,738 Views)