Mathscript node and arrays

hello, I am new to LabVIEW, so I need ur help. I want to provide some controls to mathscript window and it has to output an array/matrix.. Please help me.

Raghavendra1 wrote:
hello, I am new to LabVIEW, so I need ur help. I want to provide some controls to mathscript window and it has to output an array/matrix.. Please help me.
You always choose datatypes for input and output, can you give little more info about your program or vi what exaclty you want to do.
check this also:
Developing Algorithms Using LabVIEW MathScript RT Module: Part 1 – The LabVIEW MathScript Node

Similar Messages

  • Move code between MathScript Node and MathScript Window

    It seems like there should be some way to easily move between the MathScript Node, block diagram view and the MathScript Window.
    All I can find is saving to a script and reloading in the other view.
    Am I missing something?

    Hi wildcatherder,
    That seems to be the only way that I've been able to see to interface the MathScript Node and the MathScript Window.
    Is there a particular reason you're switching back and forth between the two?
    Regards,
    Joel I.
    Applications Engineer
    National Instruments

  • Mathscript node and mathlab

    Hi guys
    I need to convert some program from mathlab to LV.
    However, I have little idea which to node to use.
    So, i will have a few question for u guys
    1) Because I m a lazy person, I dun wan to start to write the code from scratch in LV.
    I heard about

    Hello Sir Knight AltenBach:
    Some comments on capabilities of MathScript versus Matlab and recently the
    new ScieLab 5.2. I started using it for LV8.2 for work involving quantum noise statistics in image sensors . Although it has increased more analysis functions and speed for each new LabVIEW release, there are serious limitations of this tool. So its probably only good as some small code insertions between codes for hardware calls for processing signals when they become available as arrays. First,  "not all functions is supported in LabVIEW Runtime" e.g. get (), set () etc. so scripts stays as long as LV Development environment stays with it to execute it. Second is - it still does not support "multi-dimensional arrays" - consider for example converting an RGB image to an array in LabVIEW and wiring the result as input node array here [nn,mm,nc] = size(array); can't work but [nn,mm] = size(array); don't receive a complain - in other words we can't go beyond 2D array math with MathScript. The third, is Mathlab will not work  entirely with calls to Matlab or Scielab toolkits (Scielab nodes only works on LV8.0 to 8.2 for lower than 5.2) . So m-scripts should be written carefully inside these nodes! Forget cell arrays {}, forget structs, forget multidimensional arrays. Fourth, is  that you can define m-functions and actually execute it but only on a MathScript Window, you need to actually wire in every text on the script inside a MathScript in  a new VI identifying all the entries and exit node variables to connect to. If your trying to save ~USD$5K for a Matlab license and felt you need to do it in "hybrid style programming" interfacing the IO instrumentation capability of LabVIEW with the efficient array processing in Matlab - you probably need to work with them together anyway because you need to cut and paste every command you did in Matlab to the command window of MathScript - type help for each keyword built-in function and observe how they behave if at all they do the same thing or not.  
    Bernardino Jerez Buenaobra
    Senior Test and Systems Development Engineer
    Test and Systems Development Group
    Integrated Microelectronics Inc.- Philippines
    Telephone:+632772-4941-43
    Fax/Data: +632772-4944
    URL: http://www.imiphil.com/our_location.html
    email: [email protected]

  • Combining formula node and arrays for calculatio​n

    Hello all!
    I have two arrays containing values defined by me. Each value of respective column and row index shall be used in a formula to calculate the new value for the respective column and row, to build a new array for further use. This shall be done several times during a simulation with variable function parameters.
    I am aware that I should probably use a for loop for this calculation, but I am curious to how I should build such a procedure.
    Any ideas?

    Hi Euler123,
    Let's say that you have an array of fix size and with values in it. Then you'll need to use auto indexing at the beginning of each for loop input tunnel (usually it is by default for for loops) as shown below:
    In the first iteration of the other for loop, it will take the first row values [1, 2, 3] and pass it to the inner for loop (unless you want to extract the values for each column, transpose that 2D array before connecting it to the outer for loop). In the inner for loop, it will execute 3 times and each iteration it will extract each element from the array obtained from the outer for loop. 
    To build the new array, it's just the opposite. Pass the element out from the for loop and instead of getting a last value tunnel, you'll get an auto indexing tunnel (default for for loops).
    Anyways, you'll need to get some basic understanding on LabVIEW first. Here's some tutorials to aid you on understanding For Loops.
    http://www.youtube.com/watch?v=ziOnPNJgeVg
    Here's some additional notes which might help you:
    http://zone.ni.com/reference/en-XX/help/371361J-01​/lvhowto/auto_indexing_1/
    http://zone.ni.com/reference/en-XX/help/371361H-01​/lvhowto/auto_indexing_1/
    http://zone.ni.com/reference/en-XX/help/371361G-01​/lvhowto/auto_indexing_1/
    Play around with For Loops and use something to slow the execution down like Highlight Execution which allows you to see what is going on. Else, take up some LabVIEW courses
    Warmest regards,
    Lennard.C
    Learning new things everyday...

  • MathScript Node in PPL

    Hi,
    I am trying to compile a Packed Project Library containing every classes in my project. What I did is I created a project library, added the classes in it and made a build spec for the PPL. I got an error during the build process saying that one of my VI used a MathScript node and that this couldn't be part of a PPL. So I removed the class containing this VI from the library, as well as the classes containing VIs calling this VI, and so on... But I still get the same error for that same VI when trying to compile the PPL. Why is that??

    It sounds like there must be MathScript nodes left somewhere in the application.
    Try opening one of the VI's and pressing CTR+F to open the Find Dialog. In there you can select the MathScript node as the object you are searching for and keep the search scope as "All VIs in Application Instance."
    You also can try building a packed project library of smaller parts of your VIs to try and isolate what section may be causing the error.
    Craig H. | CLA | Systems Engineer | National Instruments

  • Dynamically loading the MathScript Node

    Hi - Is it possible to dynamically load script into the Mathscript Node at Run time. I see that you can use define functions and paths and things . But being a newbie to Mathscript could all this hang together to make dynamic loading a possibility and how?
    thanks dht 

    Hi,
      unfortunately the node doesn't support run-time dynamic loading of scripts. You can load variable values with the load function, but not scripts.
    http://zone.ni.com/reference/en-XX/help/371361A-01/lvtextmath/msfunc_load/
    http://zone.ni.com/reference/en-XX/help/371361A-01/lvhowto/saving_loading_scripts/
    Depending on your application, you could use a case statement to decide between several pre-built (and possibly compiled) mathscript nodes, and acheive the functionality that way.
    Another option might be to use the formula vi's instead, although this will require a more complex architecture to parse the text file you'd generate.
    For more information on MathScript, please see the following link
    http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&568C773718B080F286257096005BD314
    Hope that helps
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer

  • Mathscript node: an internal mathscript error has occurred: 64-bit LabVIEW 2009

    Hi Folks -
    I have an installation now of
    LabVIEW 2009 9.03f, Vision, and Advanced Signal Processing Toolkit, all
    64-bit versions on a new computer so that I can convert some code from
    32- to 64-bit.
    I figure I will address errors
    one-by-one and here's the first one.  I have a VI with a mathscript
    node and the VI, which loaded and ran fine in the 32-bit environment,
    is now broken and giving the error "mathscript node: an internal
    mathscript error has occurred."  My main concern - is mathscript not
    supported in 64-bit LabVIEW right now?
    I am attaching the VI.  Any ideas are appreciated.  I need to get this working.
    Also, NI, is there a special 64-bit forum that we should post to in the future, or create to post to?
    Sincerely,
    Don 
    Solved!
    Go to Solution.
    Attachments:
    sort.vi ‏753 KB

    From 2009 help
    LabVIEW MathScript is a text-based language you can use to write functions and scripts. You can process scripts using LabVIEW MathScript in the LabVIEW MathScript Window or a MathScript Node. When you create a LabVIEW MathScript, you must use supported data types.
    The MathScript syntax is an intuitive and logical
    syntax predominantly based on standard mathematical and computer
    programming terms, terms in widespread and common use, and/or
    descriptive abbreviations, truncations and concatenations of standard
    terms. The LabVIEW MathScript Window and MathScript
    Nodes are able to process files you create using the current MathScript
    syntax and, for backwards compatibility, files you created using legacy
    MathScript syntaxes. The LabVIEW MathScript Window
    and MathScript Nodes also can process certain of your files that use
    other text-based syntaxes, such as files you created using the MATLAB® software. Because the MathScript RT Module engine is used to process scripts in the LabVIEW MathScript Window
    and MathScript Nodes, and because the MathScript RT Module engine does
    not support all syntaxes, not all existing text-based scripts are
    supported.
    (LabVIEW 64-bit) LabVIEW MathScript is not supported in LabVIEW (64-bit).

  • Mathscript node problem - specgram function of matlab

    Hello...
    I used to use "specgram" function
    of matlab, in a M file builded to perform FFT spectral analysis in
    signals. I am trying to build a VI to perform the same action.
    In
    a blank VI I created a Mathscript node and pasted the code of my M file
    inside it. After adjust the input and outputs of the node, I run the VI
    and received the Error message "Unknown symbol on line 7 : specgram"
    How do I solve this issue? How do I execute the specgram inside the mathscript node?
    Thank you in advance
    Dan07

    Hello Luciano...
    -    First of all I use the “load” command to open an ASCII file into Matlab;
    -    The ASCII file has 3 columns:
    o    Column 1: Time Series
    o    Column 2: 900 seconds of Signal 1
    o    Column 3: 900 seconds of Signal 2
     “After this point, all the operations were performed in the same way
    to both signals, I will in the next steps talk about only one signal to
    produce  a short text
    -    The Signal was interpolated by cubic spline interpolation using 10 Hz (one point each 100 ms);
    -    The new sequence of values of the signal has 9001 values;
    -    This new series was splitted into 34 segments of 512 points each, overlapped by 50 % (256 points);
    -    Short Time Fourier Transformation was performed in each segment, using the specgram function of Matlab;
     This operation resulted in 5 ascii files:
    o   B: ascii file with 34 columns, each
    column represent one segment and has the values that build the spectrum
    of the segment - signal 1
    o   C: ascii file with 34 columns, each column represent
    one segment and has the values that build the spectrum of the segment -
    signal 2
    o   pi: ascii file with one column with 9001 interpolated values - signal 1
    o   fi: ascii file with one column with 9001 interpolated values - signal 2
    o   X: ascii file with 4 columns and 34 lines (one line for each segment), with mean and SD values for signals 1 and 2
    I have already build a VI that generates the interpolated series of values and splits it as well, but using spectrogram function in labview I didn't get the same results (values) of specgram (matlab).
    Thanks in advance
    Dan07
    Attachments:
    Code.vi ‏16 KB

  • How to use mathscript node in server side with the parameter from the client side

    I tried to develop a server/client system with some algorithms written in matlab. So I included a mathscript node on the server side. The client will send the parameter to the server. According to these parameters, the sever will call the matlab functions to do some computings and then send the results back to the client. The server has to wait for all parameters received before the computings. How do I know this since I only connect the parameter variables to the inputs of mathscript node on the server. The sever cannot know whethere these parameters are the new ones or old ones since the client may send parameters multiple times?

    It seems to me you have two perfectly good options to start with. You could send all possible parameters in a single packet from the client to the server. This could be in the form of a cluster or an array of values. If by server/client you mean you are sending data over the network, then you could flatten this data to string before sending and unflatten it on the other side. Since all parameters come in one packet, you know all the data is valid every time you send data.
    The other option is to send the parameters individually, but include some extra information such as a timestamp or iteration count. The server keeps reading and storing parameter values until a packet arrives with the next timestamp. Alternatively, you could include some information such as an end-of-parameter-list boolean that is sent with every parameter. It would be false until the last parameter packet.
    Give it a thought. There are lots of solutions.
    Jarrod S.
    National Instruments

  • Changing a path dynamically in a MathScript node

    I have inherited a MatLab script that must be run in LabView. The first issue I have is creating unique paths. When a Unit Under Test runs, its data will be saved to a file based on the serial number of the UUT. The MatLab script then analyzes the data from that file and creates a new file based on the serial number with a new file extension. Therefore, I need to read in a file whose path changes and write a file whose path changes. The relative path will be the same but the unique file will not. I am looking for suggestions on how to do this since there will be hundreds of serial numbers being tested. It would be nice if the node could have an input that could configure to a path or string type instead of a scalar only. The serial numbers will be apha-numeric and this must be able to exist as a stand alone application.
    Also, the node reports a 'unexpected token: function'. I am noticing that functions must be a seperate .m file but how do you call the function after that?
    I am using LV 8.5
    Thanks - Jeff
    Message Edited by j.masse on 07-07-2008 07:57 AM

    Hello Jeff,
    Creating unique paths is not difficult in MathScript.  Simply pass in the string you want to use as the specific part of the path and have a local variable contain the base path.  For example, if you have a string input named serial to the MathScript node, the following code will build a path:
    basepath = 'c:\data\';
    filename = [basepath serial];
    You mention needing to do this for a large number of files.  The easiest way to do this is to have your loop in LabVIEW and simply pass in one string at a time to the MathScript node to do your processing.  If there is a lot of setup work involved before the work that needs to be done for each file, then it is more complicated.  There really isn't a concept of an array of strings in the language.  The closest you can get is a cell array containing many 1D character arrays.  However, LabVIEW MathScript does not yet support this construct.
    You can pass in a LabVIEW 1D string array -- the MathScript node input will adapt to the type wired to it.  What it does is create a 2D character array in MathScript.  If not all the strings are the same length, then it will pad the end of the string with zeros.  This presents a problem when you try to use the string as a filename.  However, you can use the strrep (string replace) function to replace the zeros with empty strings.  For example, assuming you have an input variable named serial that is a 1D array of strings and a loop-control variable named index, type
    basepath = 'c:\data\';
    name = strrep(serial(index, : ), char(0), '');
    filename = [basepath name];
    You cannot write a function inside of a MathScript node.  What you can do is create a .m file on disk and add the directory to your MathScript search path.  The default search path is your "My Documents\LabVIEW Data" directory.  But if you add the file elsewhere, there are three ways to set the search path for MathScript.  First, from the MathScript Window, go to "File >> LabVIEW MathScript Properties" and click on the "MathScript: Search Paths" category item.  This will set the search path for the MathScript Window only.  Second, from a LabVIEW VI, go to Tools >> Options and click on the "MathScript: Search Paths" category item.  This will set the search path for all VIs in the main application instance only.  Third, from within the project explorer, right-click on "My Computer" and select Properties.  Then click on the "MathScript: Search Paths" category item.  This will set the search path for that context only.  Since you are talking about using this in a built application, the third option will likely be what you need.
    As for using a built application generally, as long as you avoid any MathScript function that describes itself as being unsupported in the run-time engine, you should be okay.  The help for individual functions will list if they are unsupported.  You can see a list of all such functions by looking in the LabVIEW help index for "MathScript" and double-clicking on the entry for "functions not supported in Run-Time Engine."
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

  • Mathscript node access to class data

    I am trying to implement some code which I developed in Matlab in Labview. The code uses functions from the Control and Optimization toolboxes, and looks like it will port easily to Mathscript. I need to parameterize a state-space model of several drugs from several parameter (age, height,weight, gender). I can see how to create an lvclass Patient with a control which uses these four parameters in the private data. I'd like to be able to duplicate the Matlab-style syntax of Patient.Age, etc, by just wiring the Patient object to a Mathscript node.  There doesn't seem to be a way to do this without unbundling first. This seems inelegant, as it requires me to hard-code the names of the private data fields in the mathscript node interface. Is there a simple way to define lvclass data in a class VI's mathscript node?
    Matlab 2008a, Labview 8.6, MacPro OSX 10.5. 

    Hello,
    The MathScript syntactical element you are referring to is a structure.  Unfortunately, we do not have support for structures or cell arrays in MathScript at this time.  It is a limitation we are aware of and investigating for a future release.    You have discovered the workaround.  You will need to unbundle your class data and create separate variables for each member variable in the MathScript node.
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

  • Strange behaviour with ActiveX invoke node and Excel

    I want to send a table of numbers from LV50.1f to Excel97. After getting a
    reg to Excel8.Application I retrieve the Workbooks property, Invoke Item to
    select a certain Workbook reference, retrieve the Worksheets collection
    reference, Invoke Item and then get a reference to WORKBOOKS again.
    Strangely, there is an example code from the NI web site that does exactly
    the same, but in the last step a variant is returned in stead of a
    reference, which is converted using Variant to G to a Worksheet reference.
    when I copied that last invoke node to my VI I also had a variant returned,
    so on one diagram I had to invoke nodes connected to the same sources, one
    returning a ref, the other returning a variant!
    Disco
    nnecting the sources to my Invoke node and rewiring gave no change.
    Also type casting the ref to workbooks to a worksheets ref, didn't work - I
    get errors in the following property node that retrieves a Range - which
    exists in Worksheet, but not in Workbooks.
    Appearantly, LV gets the returned type mixed up sometimes, and there is no
    way to fix it other then copying a invoke node from another diagram?
    Finally I got it working though, but this behaviour puzzles me. Contrary to
    the example from NI, I now managed to send a table (2d array of strings) in
    one call to Excel (don;t need to loop over cells or columns).
    PS
    I used to do the same using DDE but ranges are different for each language
    version of Excel (i.e. R1C1 for English and R1K1 for Dutch), so my VI's need
    to know the language of Excel. Also with NT and Win98, getting a DDE
    connection often hangs LV. But a big progress has been made - now I need
    different VI's for each version of Excel!!!
    Ferry Toth
    Enraf BV, The Netherlan
    ds

    Hi Enric,
    Can you try your queries again using the new release of DB XML? It contains some improvements in this area.
    http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html
    John

  • Is it possible to define a function in the MathScript Node

    Is it possible to define a function in the MathScript Node

    You can not define a function inside of a MathScript Node, but only because it isn't necessary. The way custom functions work in MathScript is that they are saved in .m files located in paths in the MathScript path list. When the MathScript compiler receives a function that it doesn't recognize, then it searches for it in the path list, and upon finding it, compiles and loads the function. You can specify these search paths manually by going to File>>MathScript Preferences from the MathScript Window or dynamically by using the path() command within a script.
    To answer your original question, if you would like to create custom functions dynamically within a VI, then you can simply build your custom functions using strings and then save them to an ASCII file with the extension .m. You could either save the file to a path already in the MathScript path list or you could dynamically specify the path by passing the path into a MathScript Node as a string and by using the path() command at the beginning of your script to set it.
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments

  • Calling a .m file from inside a mathscript node

    hello all i am hoping someone can help me out, I am in the process of converting our version 7.11 matlab node vi's to mathscript (I hope) AND I HAVE RUN INTO AN ISSUE. we have a very simple matlab script that bundled the data and sent it to another matlab sub routine. when i copy this script over to mathscript I get the following eror: Unknown symbol on line 13: Pre_Process_Function_Pulse. Is there a way I can call and run these subroutines from the mathscript node? Do i need to convert the sub routines into a mathscript file? or do i just need to change the syntax for my call? bmp of the offending line in mathscript attached. please forgive if this is an easy question, I am not really a matlab programmer, the files that we are running are provided from elsewhere, and i get to integrate them any and all help is always appreciated thanks Chris
    Attachments:
    mathscript.JPG ‏51 KB

    Hello again,
    Ok I am still having issues running the matlab script in mathscript.  I have gone back to the original scripts with all the nested sup routines.  and the mathscript code is just a call to the first .m file subroutine.  but for some reason mathscript will not recognize the function call as a call?  I recreated the original matlab node in a sequence, so the matlab node runs (successfully) and then the next sequence is the identical call in mathscript.  I have set the path in mathscript to the directory where all the .m files are located.  The pre-process_function_pulse .m file sequentially calls 6 very small .m subroutine files.  all are located in the same directory.  and this directory is the only one listed under path and working directory in Mathscript preferences.  Additionally from the last suggestions all traces of the original japanese comments have been deleted from all the .m files.  The inputs and outputs are the same for the matlab and mathscript nodes.  so i am basically at a loss here.
    Any and all help will be greatly appreciated.
    thank you
    Chris
    Attachments:
    mathscript.doc ‏138 KB

  • 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

Maybe you are looking for

  • HT1229 How to move a 115 GB Library folder to a new location

    I have a 115 GB iPhoto library, and every time that I try to copy the library the sistem give my these error: " The Finder can't complete the operation because some data in "iPhoto Library TMF" can't be read or written. (Error code -36)"

  • Single or multiple check box values displayed in a text field

    My apologies, this may be a duplicate discussion. I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are sel

  • Handling states within selfmade components

    Hey folks, I have got a tiny problem. I have made a program that contains saveral states, two of them are "Login" and "Board". In the Login state I refer to the "compLogin" Component. There, the user has to login and afterwords the program has to swi

  • PXI-8420

    Can a PXI-8430/8 be used to replace a PXI-8420/8 in an automated test bench? I have existing software written in LabView for a PXI-8420/8 for which I do not have source code. I only have an execuatable.

  • Merging Partitions - forgot to preserve permissions

    Hello Archers, Recently I was merging some partitions on my drive, and stupidly forgot to preserve the permissions when using cp. It seems that all files are now owned by root 755. I have fixed my home directory permissions, but it seems there are a