Pointer to array

Hello,
I'm having some trouble in sending a pointer to a predefined array through
the GPIB using labview (6i).
Is there any way to create an array and a pointer to it in labview
without going through the call library functions? Even if that were the
only way, can anybody help me to get started?
Thank you very much for your help,
Riccardo

Are you trying to send some data to an instrument?

Similar Messages

  • Array pointer in array

    Can anybody tell me how to create pointers in an array pointing to other arrays?

    RichL wrote:
    Hi tbob,
    thanks for your suggestion! I did build it up with three arrays and a numeric control to select one of the arrays, which works fine. However, there are the following effects which I don't understand yet.
    1. The RefArray can only be defined as Variant, showing a violet colour instead of a green/blue as in your example; I could not find a refnumber without giving me an error.
    2. By changing the array selector, following array elements are being written into: 1,1 of array0; 0,0 of array1 and 1,0 of array2. I don't see why it is different for each array. Is there a possibility to select the array element being written into?
    My VI is attached, LV7.1
    Kind regards
    Richard
    Strange, when I created my vi, the RefArray was blue-green, not a Variant.  On the front panel I placed a blank array.  Then I placed a Control Refnum into the array.  Now the array is defined as a Control Refnum Array, not a Variant.
    Attached is a vi similar to the picture I had previously attached.  In your case, you would need a slightly different method because of your unknown quantities of channels for each source.  The use would select a source, and then you would have to retrieve an array of channels for that source.  The user then selects a channel, and you would have to retrieve the data for that channel.
    Post what you have so far so that we can look at it.
    - tbob
    Inventor of the WORM Global
    Attachments:
    RefArray.vi ‏50 KB

  • Null pointer with array

    Please help! I'm new to Java and have done the following:
    Created an array to hold 100 records.
    Created 5 records for the array (index 0, 1, 2, 3, 4)
    Now I'm trying to use a for loop to have a write output of the array values and I'm getting a NULL pointer exception.
    Any ideas???

    When an array is initialized, all its values initially point to null (except for primitives, which point to their respective 0's).Try printing out the index of the value before you print the value - it should fail at index 5. If you want to end the for-loop at the first null entry, use
    for(int index = 0 ; index < array.length && array[index] != null ; index++)
       array[index].doStuff();
    }if you only want to print out non-null values, and skip all the rest, instead use
    for(int index = 0 ; index < array.length; index++)
       if(array[index] != null )
          array[index].doStuff();
    }

  • C: appending pointer to array of pointer

    Hello.
    I am trying to code a html parser in C but I ran into some troubles.
    Well... first the relevant code so that you know what I am talking about.
    I have this structure which will hold an html tag.
    struct tag {
    char *name;
    char *content;
    struct attribute *attributev;
    int attributec;
    struct tag *subtagv;
    int subtagc;
    struct tag *parent;
    Then I want to write a function which takes two tags as arguments and adds the second tag to the array of tags (subtagv) of the first tag.
    /* appends subtag in the tag's list of subtags. returns a pointer
    * to subtag (2nd argument) */
    struct tag *tag_append(struct tag *tag, struct tag *subtag) {
    /* allocate space for another tag */
    tag->subtagv = realloc(tag->subtagv, sizeof(struct tag) * (tag->subtagc + 1));
    /* set tag->subtagv[tag->subtagc]'s address to subtag ...
    * but I don't know how to handle this */
    /* FIRST TRY: I can access tag->subtagv[tag->subtagc] via
    * tag->subtagv+tag->subtagc as I can access *int[10] via
    * *int+10. But this gives a gcc error:
    * "invalid lvalue in assignment" */
    /*tag->subtagv+tag->subtagc = subtag;*/
    /* SECOND TRY: copy subtag's address into tag->subtagv +
    * tag->subtagc's address with memcpy. But this will through
    * various glibc errors */
    /* memcpy(&tag->subtagv+tag->subtagc, &subtag, sizeof(struct tag*)); */
    tag->subtagc++;
    return subtag;
    As a matter of completeness here the glibc runtime error:
    *** glibc detected *** ./main: corrupted double-linked list: 0x0000000000544060 ***
    ======= Backtrace: =========
    /lib/libc.so.6[0x2b710a876f3d]
    /lib/libc.so.6[0x2b710a876fea]
    /lib/libc.so.6[0x2b710a878d8f]
    /lib/libc.so.6(malloc+0x7d)[0x2b710a87a93d]
    ./main[0x40094a]
    ./main[0x40072d]
    ./main[0x400669]
    /lib/libc.so.6(__libc_start_main+0xf4)[0x2b710a82a2f4]
    ./main[0x4005b9]
    ======= Memory map: ========
    00400000-00401000 r-xp 00000000 fe:00 2011796 /home/harlekin/code/html/main
    00501000-00502000 rw-p 00001000 fe:00 2011796 /home/harlekin/code/html/main
    00502000-005a7000 rw-p 00502000 00:00 0 [heap]
    2b710a6f2000-2b710a70c000 r-xp 00000000 fe:00 3155971 /lib/ld-2.5.so
    2b710a70c000-2b710a70e000 rw-p 2b710a70c000 00:00 0
    2b710a80b000-2b710a80c000 r--p 00019000 fe:00 3155971 /lib/ld-2.5.so
    2b710a80c000-2b710a80d000 rw-p 0001a000 fe:00 3155971 /lib/ld-2.5.so
    2b710a80d000-2b710a93b000 r-xp 00000000 fe:00 3155977 /lib/libc-2.5.so
    2b710a93b000-2b710aa3b000 ---p 0012e000 fe:00 3155977 /lib/libc-2.5.so
    2b710aa3b000-2b710aa3e000 r--p 0012e000 fe:00 3155977 /lib/libc-2.5.so
    2b710aa3e000-2b710aa40000 rw-p 00131000 fe:00 3155977 /lib/libc-2.5.so
    2b710aa40000-2b710aa47000 rw-p 2b710aa40000 00:00 0
    2b710aa47000-2b710aa54000 r-xp 00000000 fe:00 216919 /usr/lib/libgcc_s.so.1
    2b710aa54000-2b710ab53000 ---p 0000d000 fe:00 216919 /usr/lib/libgcc_s.so.1
    2b710ab53000-2b710ab54000 rw-p 0000c000 fe:00 216919 /usr/lib/libgcc_s.so.1
    2b710c000000-2b710c021000 rw-p 2b710c000000 00:00 0
    2b710c021000-2b7110000000 ---p 2b710c021000 00:00 0
    7fffa03a2000-7fffa03b8000 rw-p 7fffa03a2000 00:00 0 [stack]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vdso]
    Abgebrochen
    I think the first try would be the most elegant method but as I said I cannot realize it.
    With the second try I am not quite sure if my arguments I'm passing to memcpy are right. I always get confused with pointers to pointers as I am quite new to it.
    Thankful for any answer.
    harlekin
    Last edited by harlekin (2007-04-29 12:39:25)

    Your problem is that you've declared it as an array of structs, not as an array of pointers.  An array of pointers would be declared like this:
    struct tag **subtagv;
    If you want to continue using an array of structs, you'll need to use memcpy, like this:
    memcpy((tag->subtagv)+(tag->subtagc), subtag, sizeof(struct tag));
    If you want to use an array of pointers, then simple assignment (where you got the invalid lvalue before) will work, after changing your declaration of subtagv.
    Last edited by Cerebral (2007-04-29 13:18:55)

  • Motion Assistant Contour Array Points - Optimal Array Size?

    I am working with the NI Motion Assistant API and plyaing around with the Contour Move generation where I feed a set of X, Y target points to the Set Contour Move Properties.
    One of the inputs is Profile Calculation Constraint - Array Size, Constraint Value (which would be the array size to use).
    I am wondering if there is a way to calculate the "optimal" array size for any particular move?  I know I can have too few - can I have too many points in an array (being reasonable here and not planning to use the whole 2^32 size allowed).
    Thanks.
    Ryan Vallieu
    Automation System Architect

    Hi Ryan,
    Unfortunately, I'm not so sure I have a good answer for you. I'll evaluate some of the pros and cons below and then ultimately make a recommendation:
    Constraint Type: Array Size
    Pros
    You always have a fixed sized array of setpoints. If you are using a 73xx card, this simplifies setting up your contour buffer. It also avoids using a lot of memory.
    Cons
    For long moves, you could have a long time and large distance between position setpoints. The motion card will do a spline interpolation to smooth the move, but the splining algorithm is only so good.
    If you are sending the contour setpoints to a motion card, you don't know the interval between setpoints (although this isn't difficult to obtain).
    Constraint Type: Sampling Time
    Pros
    Regardless of the move, you always have a fixed time between setpoints. As long as your sampling time isn't too large, even fast moves should execute accurately.
    Cons
    For a long move, you could generate a lot of setpoints that consume a lot of memory.
    Setting up contouring buffers can be trickier.
    Conclusion
    It depends on what you expect the end customer to be doing. I prefer using the sampling time constraint since it is more robust for fast, long moves (and still good for slow, short moves). It will make creating contour buffers more difficult, but there is an example (Two-Axis Smart Contouring.vi) that shows how to dynamically update the buffer. Ultimately, I think it is better to focus on accurate moves than minimizing memory consumption.
    If you decide to go with the sampling time method, I would start with a constraint value of .01, since 10msec is the shortest interval when configuring a contour buffer. Try and generate some position profiles to see how big the arrays are. For optimizing, it is just a tradeoff between array size and the accuracy of the generated motion profile.
    Thanks,
    Paul B.
    Motion Control R&D

  • Pointer of Array in die Middel of an Array

    i have a 30mb large Array of Byte A, i need 10Mb from this Array in an new one B.
    But a dont want to copy the Data.
    I want that in my prog: Array B is 10MB and start at Index x of array A.
    Is this possiple? or i have to copy it?
    thaks for help.
    CU
    Christian

    im sure that this works for me:
    i need it for:
    byte[] audioBytes;  //myArray
    line.write(audioBytes, b, byteCount); //SourceDataLine line = (SourceDataLine)AudioSystem.getLine(info);line.write want an Array no "virtual Array" ;-(
    Any idee?

  • Call library function node with array of clusters using array data pointer

    Hello all.
    I am writing a LabVIEW wrapper for an existing DLL function.
    The function has, as one of its parameters, an array of structs.  The struct is very simple, containing two integers.  I am using the call library function node to access it.
    In Labview I created an array of clusters, where the cluster has two 32-bit integers as its members.  So far, so good.
    Now I have to pass this in to the Call Library Function Node.  Here I am running into trouble.
    I have used The topic in LAVA and The topic in the knowledge base as my primary sources of information, though I have read a bunch of forum topics on the subject too.
    I do understand that I could write a new function which takes as a parameter a struct with the size as the first member and an array as the second, and I might just do this and have it call the regular function, but I was hoping to do it more simply.
    According to the C file which LabVIEW generates for me from the CLFN when I choose "Adapt to Type" and "Array Data Pointer", the prototype it is expecting is:
    int32_t myFunc(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, void data[], int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    And the prototype of the function in my DLL is
    int borland_dll myFunc(DWORD handle, usint channel,
    int FIFOnumber, struct mStruct *data, int numWords, int *actualLoaded, int *actualStartIndex);
    This looks like a match to me, but it doesn't work (I get garbage in data).  From the topic in LAVA referenced above, I understood that it would work.  It does not.
    If I cast data to the pointer-to-pointer I get when I generate c code by wiring my struct to a CIN and generating, then I seem to get what I expect. But this seems to work when I choose "pointers to handles" too, and I would expect array data pointer to give a different result.
    Is there any way to get this to work directly, or will I have to create a wrapper?  (I am currently using LabVIEW 2011, but we have customers using 2009 and 2012, if not other versions as well).
    Thank you.
    Batya
    Solved!
    Go to Solution.

    OK, here is more detailed information.
    I have attached the VI.
    This is the code from the  "C" file created by right-clicking the CLN and creating a "C" file. 
    When the parameter in the CLN is set to "array data pointer":
    /* Call Library source file */
    #include "extcode.h"
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, void data[], int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, void data[], int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex)
    /* Insert code here */
     When the parameter is "pointers to handles":
    /* Call Library source file */
    #include "extcode.h"
    /* lv_prolog.h and lv_epilog.h set up the correct alignment for LabVIEW data. */
    #include "lv_prolog.h"
    /* Typedefs */
    typedef struct {
    int32_t control;
    int32_t data;
    } TD2;
    typedef struct {
    int32_t dimSize;
    TD2 data[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    #include "lv_epilog.h"
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex)
    /* Insert code here */
     When the parameter is set to "handles by value":
    /* Call Library source file */
    #include "extcode.h"
    /* lv_prolog.h and lv_epilog.h set up the correct alignment for LabVIEW data. */
    #include "lv_prolog.h"
    /* Typedefs */
    typedef struct {
    int32_t control;
    int32_t data;
    } TD2;
    typedef struct {
    int32_t dimSize;
    TD2 data[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    #include "lv_epilog.h"
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex);
    int32_t Load_Transmit_FIFO_RTx(uint32_t handle, uint16_t channel,
    int32_t FIFOnumber, TD1Hdl *data, int32_t numWords, int32_t *actualLoaded,
    int32_t *actualStartIndex)
    /* Insert code here */
    As to the DLL function, it is a bit more complicated than I explained above, in the current case.  My VI calls the function by this name in one DLL, and that DLL loads a DLL and calls a function (with the same name) in the second DLL, which does the work. (Thanks Rolfk, for helping me with that one some time back!)
    Here is the code in the first ("dispatcher") DLL:
    int borland_dll Load_Transmit_FIFO_RTx(DWORD handle, usint channel, int FIFOnumber, struct FIFO_DATA_CONTROL *data, int numWords, int *actualLoaded, int *actualStartIndex)
    t_DispatchTable *pDispatchTable = (t_DispatchTable *) handle;
    int retStat = 0;
    retStat = mCheckDispatchTable(pDispatchTable);
    if (retStat < 0)
    return retStat;
    if (pDispatchTable->pLoad_Transmit_FIFO_RTx == NULL)
    return edispatchercantfindfunction;
    return pDispatchTable->pLoad_Transmit_FIFO_RTx(pDispatchT​able->handlertx, channel, FIFOnumber, data, numWords, actualLoaded, actualStartIndex);
    borland_dll is just "__declspec(dllexport)"
    The current code in the DLL that does the work is:
    // TEMP
    typedef struct {
    int control;
    int data;
    } TD2;
    typedef struct {
    int dimSize;
    TD2 data[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    // END TEMP
    int borland_dll Load_Transmit_FIFO_RTx(int handlertx, usint channel, int FIFOnumber, struct FIFO_DATA_CONTROL *data, int numWords, int *actualLoaded, int *actualStartIndex){
    struct TRANSMIT_FIFO *ptxFIFO; //pointer to transmit FIFO structure
    usint *pFIFOlist; //pointer to array of FIFO pointers to FIFO structures
    int FIFOentry, numLoaded;
    usint *lclData;
    usint nextEntryToTransmit;
    // TEMP
    FILE *pFile;
    int i;
    TD1** ppTD = (TD1**) data;
    TD1 *pTD = *ppTD;
    pFile = fopen("LoadFIFOLog.txt", "w");
    fprintf(pFile, "Starting Load FIFO with %d data words, data pointer 0x%x, with the following data&colon; \n", numWords, data);
    for (i = 0; i < numWords; i++) {
    fprintf(pFile, "%d: control--0x%x, data--0x%x \n", i, data[i].control, data[i].data);
    fflush(pFile);
    fprintf(pFile, "OK, using CIN generated structures: dimSize %d, with the following data&colon; \n", pTD->dimSize);
    for (i = 0; i < numWords; i++) {
    fprintf(pFile, "%d: control--0x%x, data--0x%x \n", i, pTD->data[i].control, pTD->data[i].data);
    fflush(pFile);
    // END TEMP
    if ((handlertx) <0 || (handlertx >= NUMCARDS)) return ebadhandle;
    if (cardrtx[handlertx].allocated != 1) return ebadhandle;
    pFIFOlist = (usint *) (cardrtx[handlertx].segaddr + cardrtx[handlertx].glob->dpchn[channel].tr_stk_ptr​);
    pFIFOlist += FIFOnumber;
    ptxFIFO = (struct TRANSMIT_FIFO *)(cardrtx[handlertx].segaddr + *pFIFOlist);
    //use local copy of ptxFIFO->nextEntryToTransmit to simplify algorithm
    nextEntryToTransmit = ptxFIFO->nextEntryToTransmit;
    //on entering this routine nextEntryToLoad is set to the entry following the last entry loaded
    //this is what we need to load now unless it's at the end of the FIFO in which case we need to wrap around
    if ( ptxFIFO->nextEntryToLoad >= ptxFIFO->numEntries)
    *actualStartIndex = 0;
    else
    *actualStartIndex = ptxFIFO->nextEntryToLoad;
    //if nextEntryToLoad points to the last entry in the FIFO and nextEntryToTransmit points to the first, the FIFO is full
    //also if nextEntryToLoad == nextEntryToTransmit the FIFO is full and we exit without loading anything
    if (( (( ptxFIFO->nextEntryToLoad >= ptxFIFO->numEntries) && (nextEntryToTransmit == 0)) ||
    ( ptxFIFO->nextEntryToLoad == nextEntryToTransmit)) && (ptxFIFO->nextEntryToLoad != INITIAL_ENTRY)){
    *actualLoaded = 0; //FIFO is full already, we can't add anything
    return 0; //this is not a failure, we just have nothing to do, this is indicated in actualLoaded
    numLoaded = 0;
    lclData = (usint *)data; //must use 16 bit writes to the module
    //conditions are dealt with inside the for loop rather than in the for statement itself
    for (FIFOentry = *actualStartIndex; ; FIFOentry++) {
    //if we reached the end of the FIFO
    //if the module is about to transmit the first element of the FIFO, the FIFO is full and we're done
    //OR if the module is about to transmit the element we're about to fill in, we're done - the
    //exception is if this is the first element we're filling in which means the FIFO is empty
    if ((( FIFOentry >= ptxFIFO->numEntries) && (nextEntryToTransmit == 0)) ||
    ((FIFOentry == nextEntryToTransmit) && (FIFOentry != *actualStartIndex) )){
    *actualLoaded = numLoaded;
    //set nextEntryToLoad to the end of the FIFO, we'll set it to the beginning next time
    //this allows us to distinguish between full and empty: nextEntryToLoad == nextEntryToTransmit means empty
    ptxFIFO->nextEntryToLoad = FIFOentry;
    return 0;
    //we reached the end but can continue loading from the top of the FIFO
    if ( FIFOentry >= ptxFIFO->numEntries)
    FIFOentry = 0;
    //load the control word
    ptxFIFO->FifoData[FIFOentry * 3] = *lclData++;
    //skip the high of the control word, the module only has a 16 bit field for control
    lclData++;
    //now put in the data
    ptxFIFO->FifoData[(FIFOentry * 3) + 2] = *lclData++;
    ptxFIFO->FifoData[(FIFOentry * 3) + 1] = *lclData++;
    numLoaded++;
    //we're done because we loaded everything the user asked for
    if (numLoaded >= numWords) {
    *actualLoaded = numLoaded;
    ptxFIFO->nextEntryToLoad = FIFOentry+1;
    return 0;
    //if we reached here, we're done because the FIFO is full
    *actualLoaded = numLoaded;
    ptxFIFO->nextEntryToLoad = FIFOentry;
    fclose (pFile);
    return 0;
     As you can see, I added a temporary diagnostic with the structures that were created in the "Handles by value" case, and print out the data.  I see what is expected, whichever of the options I pick in the CLN!  
    I understood (from the information in the two links I mentioned in my original post, and from the name of the option itself) that "array data pointer" should pass the array of data itself, without the dimSize field.  But that does not seem to be what is happening.
    Batya
    Attachments:
    ExcM4k Load Transmit FIFO.vi ‏15 KB

  • How to use array of Point Class

    I use Point class as array. I already create that. However I can't access to setLocation.
    Ex.
    Point myPoint[] = new Point[10];
    myPoint[0].setLocation(10, 2);
    It has a error.
    Please Explain me.

    DeltaGeek wrote:
    BalusC wrote:
    Or use [Arrays#fill()|http://java.sun.com/javase/6/docs/api/java/util/Arrays.html]. Point[] points = new Point[10];
    Arrays.fill(points, new Point());
    That doesn't do what you think it does, unless you want your array to contain 10 references to the same Point object.The OP has received a good answer, I believe. So it's worth risking diverting this thread into the weeds by pointing out that if Java had closures then BalusC's code could be modified to work.

  • How do i make a array of user defined structure and creat a pointer for the same

    Function
    The prototype of the dll function is
    unsigned long PassThruIoctl(unsigned long A, unsigned long B, void *pvar1, void *pvar2);
    "void *pvar1" and "void *pvar2" are pointers to different Structures. The value of  "unsigned long B" will determine what kind of Structure the pointer will represent.
    One sample structure is given below when pvar1 is the pointer to SCONFIG_LIST.
    typedef struct
          unsigned long ParameterID;    // this an input to the dll
          unsigned long Value;          // this is an output from dll
    } SCONFIG;
    typedef struct
          unsigned long NumOfParams;    // the no. of elements(SCONFIG) in array
    (input)
          SCONFIG *ConfigPtr;           // the pointer to array of SCONFIG
    (input)
    } SCONFIG_LIST;
    The function is supposed to get the values of configuration parameters (from an external interfacing device).
    When I tried to run the function as shown in the attached VI, I always end up with error. The error I get is saying something about DLL corrupting the memory of Lab View.
    Solved!
    Go to Solution.

    What will be the structure for pVar2?
    One issue that I can see in you code is, for pvar1 instead of passing an array of clusters, you are passing a cluster of SCONFIG. Also you need to initialize the numbr of elements in the array before passing it to the DLL (see attached code). In this I have assumed that pVar2 is also expecting a similar input.
    I was not able to run the code here becasue the dll is not there. So please try and let me know.
    "A VI inside a Class is worth hundreds in the bush"
    യവന്‍ പുലിയാണു കേട്ടാ!!!
    Attachments:
    GETCONFIG_2.vi ‏9 KB

  • Pointer to LabVIEW Array

    LabVIEW memory management question:
    Question Part 1: When I write a C .dll that takes a LabVIEW array,
    LabVIEW passes a pointer into LabVIEW's memory to the array to C. 
    Can C return the pointer to me (e.g., not the array I passed in, but
    it's memory location)?
    i.e.: void GetNativeMemoryPointer(float *pointer, float *array);
    where *array is my input array, and GetNativeMemoryPointer returns the pointer to this array on *pointer.
    Question Part 2: What issues will I run in to if I pass this returned
    pointer to another .dll call.  What if this .dll call is in
    .NET? 
    Concerns: How does LabVIEW hold this array in memory?  When I call
    GetNativeMemoryPointer, does LabVIEW make a copy and send this a
    pointer to the copy to the dll, or is the pointer to the
    original?  Will LabVIEW ever "move" the original, e.g., will my
    pointer become invalid after some time?
    Joe Gerhardstein
    Averna Test Systems
    Certified LabVIEW Architect
    http://www.averna.com

    Part 1: I must confess that I don't understand your question. Pointers and arrays are very closely related in C so I'm not following the sequence. So I don't know if the following applies, but here is a possible answer...
    The pointer to a LV array that is passed to a call library node is valid ONLY during that call. Once the call to the DLL completes, you should consider that pointer value invalid. You can, of course, make a copy of the array and return a pointer to your copy - but LV won't know what it is. It definately won't show up in LV as an array. However, you can pass that pointer to the copy around to other DLLs as much as you want.
    * Don't forget to free the copy. If you make a copy of the array, you own it - therefore you must free the memory of the copy at some point *
    Part 2: Easier to answer.
    * If you want LV to convert your pointer to a LV data type (such as a LV array): Take a look at page 2-4 in the "Using External Code in LabVIEW". In almost all cases we do not support pointers. The only exceptions are the ones shown in the Call Library Node configuration. For arrays, notice that if you want to return an array to LV, we have our own defined data types for this - read up on the CIN section for more information.
    * If you want to return a pointer than LV just messages to other DLLs: No problem. Put the parameter to the routine as a pointer to integer (or a return value of type int). Thus your pointer is an integer as far as LV is concerned. When you pass it to another DLL, we'll pass the exact same value to the DLL - thus the pointer is never modified or the data touched.
    Did this help?
    Message Edited by Lycangeek on 08-10-2005 02:12 PM
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • The size limit of the OCI LOB Array Insert is 64K for one field?

    I have a table with 4 field, and one is BLOB field. I want to insert 16 rows in one OCIStmtExecute. I know I can specify the iter parameter with 16 to execute sql 16 times.
    I found example in "Application Developer's Guide - Large Objects" in page "Data Interface for Persistent LOBs 13-17", there is a example function called "array_insert". It shows the usage of OCIBindArrayOfStruct, but can only insert LOB with same size, the LOB field of each row filled with the same size data.
    But I have to insert LOB with different size, for example 8K for row 1, and 16K for row 2, 128K for row 3. Than I find the alenp parameter of OCIBindByName/OCIBindByPos. It is "pointer to array of actual lengths of array elements."(OCI document). So I think I find the solution for my problem. But the type of alenp parameter is ub2*, is it means I can only insert 64K data for each row in my array insert? It is too small, I hope I can array insert BLOB with 16M each row.
    Or there is any other solution for my problem? I look forward to it for a long time! thanks every one!

    It is called Data Interface to work with LOB datatypes by APIs designed for use with legacy datatypes. I can specify SQLT_BIN to bind memory binary data to BLOB column, and INSERT or UPDATE directly. It can be without LOB locator and save round-trip to the server. This is very fit my needs, because I have to insert very much BLOBs to server as soon as possible.
    I have make a test program, and multi-row with different size blob( less than 65536 bytes) can be insert at one time, without locators. Multi-row wiht same size blob( more than 64K) also can be insert at one time--the alenp parameter is not used. I only can not insert multi-row with different size blob( more than 64k) because the type of alenp is ub2*.
    thank you for your reply!

  • Summing specified elements in 2D array.

    Hi!
    I have a little problem with summing elements in 2D array… I have signal from 64 sources in the 2D array - 64 colums and (time*sampling) rows. I have to add some deley to every signal (different for each)  and then sum signals from all of the sources. I hope the picture below explains what I have to do:
    What's more - I have a 2D array of delays. By now I'm doing this by creating an 1D array of "0" and then putting in it the 1D signal array at index specified by delay value.
    And it works ok. But... It takes long time... Is there any method to do the summing "at once" for all the delays? Is there sth like "pointer" in array, so I could take elements from the array from specified element?
    Rgds,
    Mordimer 

    One problem with your solution is also that the subset is of variable lenght due to truncation, so the shift register needs to be reallocated whenever the size changes. (Even if you define a lenght for the subset, you run out of elements and the result will be shorter!). You might want to e.g. truncate all to the shortest subset (longest delay) before summing for better inplaceness.
    Why do you have a 2D array of delays? isn't the time spacing of each column constant?
    What is your definition of "takes a long time": microseconds?, minutes?
    Message Edited by altenbach on 12-03-2009 03:20 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Multidimensional Array in Indesign?

    Hey guys,
    normally in javascript I can just create a multidimensional array like so:
    myArray = [ [] ];
    and then assign values like this:
    myArray[0][0] = 'item1';
    In extendscript I get the error "undefined is not an object". Is there something I forgot about, or is this just not possible in Indesign?

    I found out it was another problem. The code works like this, but you need to define in the beginning how many arrays are in the array. Otherwise it will throw the "undefined" error.
    points = new Array(object.paths.length);
    for(i = 0 ; i<object.paths.length; i++){
        points[i] = new Array();
    This code works now, as the length of the array is exactly the length you need. And for every key you add another array, to create your two dimensional array on every key.

  • How to call LabView function with nested structs and arrays from C#

    Hi,
    I've got the following functions defined in a LabView-dll:
    uint32_t __stdcall VOSC04_General(uint32_t Command, TD18Hdl *Messages);
    uint32_t __stdcall CheckDiameter(uint32_t Command, TD6 *Parameter);
    typedef struct {
     double SP_Diameter;
     double SP_Tolerantie;
     double PV_Diameter;
     } TD6;
    typedef struct {
     int32_t dimSize;
     int32_t Numeric[1];
     } TD18;
    typedef TD18 **TD18Hdl;
    I've got some C#-code (generated by PInvoke-wizard) to call these functions:
    [DllImport("vosc04.dll")]
    public static extern uint32_t VOSC04_General (uint32_t Command, ref TD18Hdl Messages);
    [DllImport("vosc04.dll")]
    public static extern uint32_t CheckDiameter(uint32_t Command, ref TD6 Parameter);
    [StructLayout(LayoutKind.Sequential,Pack=4)]
    public struct TD18
       public int32_t dimSize;
       [ MarshalAs( UnmanagedType.ByValArray, SizeConst=1)]
       public int32_t [] Numeric;
    [StructLayout(LayoutKind.Sequential,Pack=4)]
    public struct TD6
       public Double SP_Diameter;
       public Double SP_Tolerantie;
       public Double PV_Diameter;
    The problem now is that when I try to read the Messages-output-parameter, I get wrong values (pointers?). I think that the problem lies in the fact that LabView generated a TD18 AND an TD18Hdl struct.
    How can I correct this problem?
    Can anyone give me some advise to correct this problem? I'm not an expert in C, only in C#.

    I think the problematic line is this:
    public struct TD18
       public int32_t dimSize;
       [ MarshalAs( UnmanagedType.ByValArray, SizeConst=1)]
       public int32_t [] Numeric;
    It looks like C# is forcing the array to be of size 1. The thing is, LabVIEW stores arrays as handles which are double pointers to a structure which contains a size element followed by the elements of the array. For your example, int32 arrays are stored in memory as:
    handle -> location -> |size|element 1|element 2| .... |element size-1|
    Because C does not do runtime array bounds checking, you can get away by declaring the structure as:
    typedef struct {
     int32_t dimSize;
     int32_t Numeric[1];
     } TD18;
    The correct declaration would've been:
    typedef struct {
     int32_t dimSize;
     int32_t Numeric[size];
     } TD18;
    But size is not a constant, so C/C++ won't let you do that. So, even though the array is declared to be of size 1, it can (and usually does) have more than 1 element. This does not cause a problem because LabVIEW allocates memory based on the actual size of the array.
    If I were you, I'd try to change the prototype of the LabVIEW DLL function to accept a pointer to array data, rather than an array handle, pre-allocate memory for the array in C# and pass a pointer to the allocated memory into LabVIEW so that LabVIEW can "fill it up".
    Let me know if you need more information.
    Pramod

  • Build Array keeps name of the last element but not the others. Workaround?

    Hi there,
    Sorry if this has been posted before, I did the search first but did not find anything.
    Problem is that I have two setups that are identical and need to be controlled from a single vi. Since they are the same they are configured with the same sets of parameters so I decided to create a cluster of these and then build an array of the clusters. This way I need to only use one wire and if I need a given parameter I can easily get it from there (or so I thought) and also since I need to see if anything changes I can compare one wire instead of each one of the parameters.
    The gui has the list of parameters then in the block diagram I bundle them appropiately, using "Bundle by Name" and then each bundle into an array using "Build Array". Problem arises when I index the array for the first setup and the use that to unbundle the parameters I need, using "Unbundle by Name" (though if I use "Unbundle" the same happens)and lo and behol, the ouput names are from the second setup, not the first.
    Here is the curious thing though, even though the names are all wrong the values are correct. I could live with this but it is annoying plus it will make another user very hard to understand the diagram plus this is just a proof of principle to test with two, eventually there will be eight or even more and that is going to get really confusing.
    Is there a way around this? Even if it is to change the names after unbundled.
    Check the attached vi to see what I mean.
    Solved!
    Go to Solution.
    Attachments:
    Test Build Array Names.vi ‏11 KB

    I think you are forgetting an important point about arrays.  The only thing that can be different between each element of an array is its value.  The array elements must all share the same properties.  So that would include the names of the individual elements that make up the cluster that is an array element.
    It appears that the last cluster that gets built into the array is the one that defines the names of the elements that are within the cluster element.  You either need to give all elements of the array the same names within the cluster.  Or use a cluster of clusters instead of an array of cluster to build your data structure.

Maybe you are looking for

  • 2 ipods connected on one computer

    We put one ipod nano on our computer in December- Now, we are trying to put another ipod on for a different user- and the first ipod user's songs continue to download onto ipod #2- and ipod #2 can't download his own music- it automatically goes onto

  • Photos get chopped

    Photos viewed from AppleTV (2.1) get automatically cropped from the top and bottom on both horizontal and vertical formats. Our TV is set for 1080i viewing. Is there way to set the photos so they appear full screen on the TV, but won't be cropped? (N

  • Media player for my website....

    Hello all, We need a media player according to the following specifications: 1. Our media player will function as a pop-up, and play as long as surfer is browsing our site. 2. Our media player will include a dynamic playlist functionality. The key fe

  • Changes need to done Customized Reports when upgrading to R12

    Hi, My Client is upgrading to R12, I need to prepare technical Document(stepwise changes need to done) for all customized and oracle reports to make working same in R12 as well. Can any one help me about essential prerquisite which i need to consider

  • I cannot access the internet. When I type in a search nothing happens.

    My yahoo homepage opens ok. I can access mail. However, when I type in a search for a web site nothing happens. It says its connecting for 3-5 minutes then just stops and I am not connected. This just started about an hour or so ago.