LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementation of an Array of Clusters in CVI ??

Hi,

I'm using CVI to make several DLL's to be used in Labview. I have an array of a cluster of three numeric data types, in other words;

typedef struct
{
uInt32 Wavelength;
float64 Power;
float64 OSNR;
} Data;

typedef struct
{
int32 dimSize;
Data peakData[1];
} DataArray;
typedef DataArray **DataArrayHandle;

This is the first time I've worked with a struct within an array in CVI, and I'm a bit confused. I have read the tblsrch.c example in Labview and I am now thoroughly confused.

I understand having to resize the array, then setting the dimension size, then allocating memory for the new Data struct. But I can't seem to figure out how to write to the Data struct member data w
/o having labview crash.

Can you provide an example of how to write to say, the Power Data member? I'm just flumoxed here.

Kindest,
Warren
0 Kudos
Message 1 of 5
(2,846 Views)
Just in case you don't get the right CVI answer here in Labview General, try the CVI link too - its probably more related to your Q.
Good Luck, Doug

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=8&RFORMNUMBER=2&RHIDETAG=TRUE&UCATEGORY_0=_46&UCATEGORY_S=0
0 Kudos
Message 2 of 5
(2,846 Views)
Hi Doug,

My question pertains to the proper use of Labview data types and structures. I believe your assessment may be incorrect. Thanks for the advice.

Kindest,
Warren
0 Kudos
Message 3 of 5
(2,846 Views)
Sorry 'bout that - see my new answer - so I could attach a file.
Doug
0 Kudos
Message 4 of 5
(2,846 Views)
Warren,
See if the attached fits in any way.
I began with an Array of Clusters, then unbundled the Cluster to access an element. Then added a new value (for Power) of one of the elements. Index the array and replaced that cluster and outputted a final array.
To run it, enter a value for the new Power (eg 5) and choose an index (eg 1). Also, put some fake numbers in the original Array so you can see the change.
Hope this shows some of the manipulations you have to go through. Good Luck, Doug
0 Kudos
Message 5 of 5
(2,846 Views)