Best way to pass an array of waveforms inbetween VIs

In my VI I am developing I have multiple data sources that output a single waveform. I group these waveforms togeather to make a wave form array. The user selects which waveform they would like to display and they are displayed on a graph on a different form. Right now I have each different graph VI generating the whole array and displaying the selected element.
My question is, this seems to be not efficent because I am generating data in 3 spots. I would think it would be better to generate it in one spot and then pass only the need data to the three graph VIs. What is the best way todo this? A global variable? Queue? Any suggestions?

You're probably tired of hearing me say this, but the global function idea is the best.
A global variable makes a COPY of the data each time you read it. That takes time, and memory. If each of 3 window reads the global, and picks out a channel, then you've made 3 copies of the original data. Depending on your data size, that may or may not be a problem.
A queue means that once you read the data, it's lost from the queue. If window A reads from the queue, that data chunk is not in the queue any longer, so Window B can't read that same data.
If the main window generates the data and deposits it in a global function, then each window can ask the global function for a specific channel to display.
DATA STORAGE.vi:
Inputs:
WRITE/read (bool
ean)
DATA IN (2-D array of DBL, for example)
Channel Index (I32)
Outputs:
DATA OUT: 1-D array of DBL (or waveform, maybe).
Code:
WHILE
If WRITE/read
Store DATA IN in a shift reg.
else
Pass Shift reg IN to Shift reg Out.
Pick out channel via CHANNEL INDEX
Pass selected data to DATA OUT.
Loop NEVER.
The purpose of the loop is just to have a shift reg. It doesn't really loop - it executes once per call.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks

Similar Messages

  • AS3 Best way to clear an array

    What is the best way to clear an array? (performance and resources)
    array.length = 0;
    array = [];
    array.splice(0);

    that's creating a new array which is extra work, and it's adding an array to the objects that flash will gc, and that's extra work.
    assigning the length to 0 is the most efficient way to clear an array.

  • Please Suggest best way to pass Strings in a pipeline

    I'm working in a project in which a line passes in a pipeline kind of situation.
    The String is passed between different modules and each module adds some more data to it (or may even remove some of it).
    Which is the best way to pass the String? I think java.lang.String might not be an efficient method because the String i'll be passing will be modified many times.
    Thanx

    Yes. StringBuffer or StringBuilder you can use.
    String string = "test";
    StringBuffer sb = new StringBuffer(string);later you will add some more strings to the StringBuffer
    sb.append("Hello World");No additiional String object will be created.

  • Best way to pass data sets to another program

    Hey
    I want to connect another (maths) program with my java application. Therefore I need to paste data (some kind of tab separated table) to this program.
    I try now to save these data in a separate newly generated file and to pass a command with Java's Runtime.exec() method to this program to read these data. Is this a good idea or might there be better ways?
    If I do so, is there a way in Java to generate some kind of a "temporary" file which will be deleted automatically after usage or is this nothing else than to save it in a common file and delete it afterwards. What's the best way to pass data generally?

    Well, the connection will not be over a network, so I'd rather think it's not a Socket or RMI problem (unless someone convinces me).
    Yes it's very external, it's a C or C++ written program, I don't have any source codes. So far I generated a file for Input command and data, I passed that on to the maths program and returned the output into another file.
    Now I would like to separate the output and like to obtain some tables and graphical things like charts at the output. Do I have to generate three different types of outputfiles? How to store some graphics e.g. some distributions. I thought even of generating a database. I never thought about XML, I don't know if this works for that kind of problem?!

  • What is the best way to pass a controllin​g signal out of a sub vi or more than one layer of for loop, while the sub vi or for loops are still running?

    I have a vi that runs through two for loops and a while loop, then after a certain number of iterations on the inner while loop it is supposed to pass a trigger to a case stucture to start measurement. I have tried using a local variable attached to a boolean control which in turn is attached to the true case of the case structure involving the measurement sub vi. What is happening is that the boolean control will light on the front panel at the correct # of iterations in the while loop, as if true, but the measurement is not taken, and the boolean control never goes back to false. It remains lit. Am I u
    sing the local variable incorrectly? If so, where am I going wrong.
    Attachments:
    GL_Flicker.vi ‏118 KB
    Take_Measurements.vi ‏147 KB

    Hello planar,
    There are multiple ways to pass control information between loops and VIs and each one has its place. For simple VIs like your example, a local variable will be fine.
    The main reason the subVI is not running is that the case structure is not continuously polling the Boolean control. This is because the case structure is not inside a loop and as such will only read the Boolean value once and execute once. Encasing the case structure and control inside the while loop should solve the issue of the subVI not running.
    You may find the following links of help in creating more robust and advanced VI architectures.
    Application Design Patter
    ns: Master/Slave
    LabVIEW Application Design Patterns
    Keep up to date on the latest PXI news at twitter.com/pxi

  • Best way to create an array of bound values (to the resourceManager for example)

    What's the best practice for creating an array (array collection) where each element is bound to another value?
    An example would be an array of error strings that are used by an application.  Each string needs to change as the resource manager changes.
    Passing a list of strings to a list control is another example.  These should get localized as well.

    hobby1 wrote:
    Crossrulz, I was planning on handling it like this: 
    I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?
    Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Best way to pass large amounts of data to subroutines?

    I'm writing a program with a large amount of data, around 900 variables.  What is the best way for me to pass parts of this data to different subroutines?  I have a main loop on a PXI RT Controller that is controlling hydraulic cylinders and the loop needs to be 1ms or better.  How on earth should I pass 900 variables through a loop and keep it at 1ms?  One large cluster??  Several smaller clusters??  Local Variables?  Global Variables??  Help me please!!!

    My suggestion, similar to Altenbach and Matt above, is to use a Functional Global Variable (FGV) and use a 1D array of 900 values to store the data in the FGV. You can retrieve individual data items from the FGV by passing in the index of the desired variable and the FGV returns the value from the array. Instead of passing in an index you could also use a TypeDef'd Enum with all of your variables as element of the Enum, which will allow you to place the Enum constant on the diagram and make selecting variables, as well as reading the diagram, simpler.
    My group is developing a LabVIEW component/example code with this functionality that we plan to publish on DevZone in a month or two.
    The attached RTF file shows the core piece of this implementation. This VI off course is non-reentrant. The Init case could be changed to allocate the internal 1D array as part of this VI rather than passing it from another VI.
    Message Edited by Christian L on 01-31-2007 12:00 PM
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
    Attachments:
    CVT_Double_MemBlock.rtf ‏309 KB

  • Best way of including timing in a waveform graph?

    Hello all,
    I've been toying with a number of different ways to do this, but so far I haven't had all that much luck. I've posted a picture so you can see what's going on. All I have is 4 plots that need to be plotted with accurate timing information on the x-axis. I guess I'm just wondering what the best way to go about this is. This method seems to be the most cluttered and messy that I've done, but is the only one I've gotten to have the actual correct timing info on the graph. I would put a wait in the loop, but I need to acquire this data as fast as possible. Thanks for any help!
    Geoff
    Attachments:
    Graphing Test.jpg ‏74 KB

    The display options you have chosen are OK on their own.
    If you're looking to get more speed out of the code, try only graphing the data every 10 iterations or so. You can save the processed data (your waveforms) in a shift register where they can then be appended every 10 iterations.
    This will obviously not clean up your code. The best way to clean up your code might be to simply throw the conversions you're performing into a sub-vi. Or create a time input for your "meters" VI and have thr processing done there with correctly-scaled values being outputted.
    Hope this helps
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Best way to return an array of values from c++?

    I have a a group of structs made of a mix of primitive types in c++. I need to return these to Java but Im not sure the best way to return them quickly.
    Should I create a class corresponding to the structure in Java then create the class in C++ and set its fields and return that? Or should I create arrays of different primitive types and return those? Can I even do that? Say, store a group of arrays of different types in a jobjectArray and return that? If I can, what would be the return type? Object[][]?

    Java side:
    package jni;
    import java.nio.ByteBuffer;
    import java.nio.ByteOrder;
    * @author Ian Schneider
    public class Struct {
        static {
            System.loadLibrary("struct");
        public static void doit() {
            ByteBuffer bytes = ByteBuffer.allocateDirect(structSize());
            bytes.order(ByteOrder.nativeOrder());
            getData(bytes);
            System.out.println("int : " + bytes.getInt());
            System.out.println("double : " + bytes.getDouble());
        private static native void getData(ByteBuffer bytes);
        private static native int structSize();
        public static void main(String[] args) throws Exception {
            doit();
    }C side (I'm not a C programmer, so be nice):
    #include "jni_Struct.h"
    struct foo {
      int x;
      double y;
    } foo;
    JNIEXPORT void JNICALL Java_jni_Struct_getData
      (JNIEnv * env, jobject obj, jobject buf) {
      struct foo * f = (void*) malloc(sizeof(foo));
      f->x = 123;
      f->y = 456.;
      void * data = (void *) (*env)->GetDirectBufferAddress(env,buf);
      memcpy(data,f,sizeof(foo));
      free(f);
    JNIEXPORT jint JNICALL Java_jni_Struct_structSize
      (JNIEnv * env, jobject obj) {
      return sizeof(foo);
    }This is a bit simplistic as foo is static in size (no pointers), but hopefully you get the point.

  • What is the best way to display different array values to appropriate indicators?

    I am using DAQmx Read vi and its output is an array. I need a way to pass each value to an appropriate front panel indicator, so I can monitor each sensor. I tried using "Index Array" and passing the array element to the indicators but it looks sloppy. Is there a more professional way? Thanks!
    Attachments:
    Mole.vi ‏215 KB

    Try using the Array to Cluster function in the Cluster subpallet. If you put all of your indicators in the same cluster on your front panel, you can then pass the array data to this function and then pass it directly to the cluster without having to index the array.
    criag

  • What is the best way to pass a constant to a cin expecting a pointer to a value?

    I have a cin which has a leg that is expecting a pointer to a value. On the diagram, what is the best way to connect a constant widget to this leg of the cin? Connecting it directly crashes labview as it treats the constant as a pointer to memory.
    Thanks

    I am not sure that I understand your issue. CIN variables can be Input-Output or Output only. Either way, they are being passed in as a pointer to a value. You can see this very easily by placing down a CIN and wiring a constant integer to it. Next, right-click on the CIN and create the C file. You will see that the parameter list has an int* in it.
    If you are still having problems, do you have to create a CIN or can you create a DLL instead? The DLL will give you a few more ways to pass the data than a CIN does with no real performance decrease.
    Also, have you read the "Using External Code in LabVIEW" manual? This hsould answer some questions as well.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Best way to Pass a Date with Time to a Page

    Has anyone come up with a simple and reliable way to pass a Date with Time "06/13/1992 10:50 PM" to a page.

    Hi Scott:
    On Page 1:
    Summary Report
    LINK  Window   Item Count      Start Date                   End Date
      X       1            7         8/2/2007 03:15:20   8/2/2007 03:18:22
      X       2          12         8/2/2007 04:01:01   8/2/2007 04:07:42When the LINK is clicked
    On Page 2:
    [:P2_S_DATE] 8/2/2007 03:15:20 [:P2_E_DATE] 8/2/2007 03:18:23 [:P2_GO]
    Detail Report
    Window   Item Number      Item Date
        1                1                8/2/2007 03:15:24
        1                2                8/2/2007 03:17:04
       ...              ...                        ...I then need to allow the users to adjust the dates and click the P2_GO and have it return the new result set.

  • Best way to pass vars from html into flash?

    I've read a variety of pages that describe how to pass a variable into a flash movie (AS3, player = v9) from the html in which it is embedded.  This page describes AS3 but neglects to mention what to do with the object and embed tags in the noscript section. Furthermore, I'm not sure the javascript I see generated in my page looks like the example there (the js in my page doesn't check AC_FL_RunContenta against zero).  This page is quite long and appears to deal mostly with AS1 and AS2 approaches which I have used before and neglects entirely the newish javascript approach which appears to be used to embed flash these days (i.e., the javascript function AC_FL_RunContent).
    I was wondering if someone could spell out the proper way to pass in a variable from HTML so that flash can see it in such a way that works even if javascript is disabled, in all browsers, etc., etc.
    I've attached the HTML generated by the Flash IDE to this topic.  Any help would be much appreciated.

    You'll have to search for that concise and thorough list of steps or figure it out using the information you now have, which is sufficient to get it done.  It's not that hard--add the FlashVars in the embedding code in the three places and use the various examples you have links to to add the code in the Flash file to access and use the FlashVars.
    Your Flash will be embedded in a web page depending on the visitors settings... if they allow javascript then the javascript portion will be used.  If they don't, then either the object or embed sections will be used depending on their browser.
    As far as javascript changes go, don't sweat 'em until you have a problem... use whatever code your Flash-created html page creates to embed the file in the page.

  • Best way to pass back data from hierarchical table view?

    Hi,
    I have a view hierarchy using a navigation controller that's working pretty well. One of the bottom level views is a table view where the user selects an item from the list. This bottom view checks the list item, saves the selected item in a property, and then pops the view off the stack.
    What's the best way to alert the parent view that the child view has been popped off so it can retrieve the value in the property? The calling push returns immediately, so it doesn't appear to be a modal call. I want to be able to use the same controller from other parent forms, so I need to be able to do this without referencing the parent in the child form ideally.
    Thanks
    Ray

    Hi, well let me try to explain it a bit more
    - Add a "delegate" property to your child-viewcontroller-class
    - Define a protocoll within each chil-viewController-class
    In this example let us name it "didSelectValue:(NSString *)value"
    - In the parent-viewcontroller before pushing a child-viewcontroller set it's delegate property to "self" (parent-viewcontroller)
    - In the parent-viewcontroller implement to protocoll-method "didSelectValue:(NSTring *)value"
    - In the child view-controller in (assuming it is a tableViewcontroller) add some code in didSelectRowAtIndexPath that checks if the delegate is set and check if it responds to selector "didSelectValue:(NSString *)value". If so, call it with the selected value.

  • Looking for a best way to arrange an array of Pop Up windows with repeating small imgs

    I would like to find out what is the best way to approach setting up various Pop Up windows.
    Here is my set up:
    I have 20+ product images which act as buttons and each brings a user to a unique section with the pop up window where a large photo of this product in use is displayed. In addition to this photo in the pop up window are additional product images (which were also used to create a photographed assembly)
    I figured that since I repeat my product images on the pop up windows and all of them are already used in the product page let me use them again in the pop up window. So I arranged the pop up windows in each separate labeled section in which I reused the product images buttons from the products page and put the UI Loader into each separate labeled section which loads the big assebly photo of that product in use.
    Here are my questions:
    - Should each product have a separate labeled section with a pop up window
         This way I can reuse a number of already existing product button images and load only the high resolution assemble image
          However I end up having a lot of sections labeled for each product
    - or it should be arranged as follows:
         var sourceVar:String;
         function my_btnDown(event:MouseEvent):void {
         sourceVar="product_popups/product1_popUp.swf;
         gotoAndPlay("productsLoader");//where "productsLoader" is the labeled secion of my UI Loader
         This way I end up with one labeled section but have to implement up to 5 buttons on each new Pop Up.  In a sence I make the size of a loading pop up .swf a bit bigger by not recycling the existing buttons, but my assumption that I will have an easier funcitonality of the site?
    I am not sure which way would be a better or more appropriate way to go?

    Léonie-
    You are totally correct regarding custom tags instead of keywords depending upon the instance.
    My main point is that Folders are mostly misused. Images need to be keyworded or tagged and linked to Albums, generally not put in folders. With digital images almost always folder organization of images is just wrong, because folders by definition locate an image in just a single category. And few images are ever just in a single category.
    Some usage of folders can be helpful. Folders of Projects (e.g. 2001 Projects, Client royalfrenchel, etc.) make sense to help collapse a large number of Projects. However note that even in that simple two-folder example images cannot be in both folders at the same time without splitting the folders up.
    IMO users should spend  time carefully establishing how to keyword/tag and aggressively avoid using folders as much as possible. Eg. in Arturo's instance "week5" should be a keyword, not a folder. That way if one wants to make a brochure and use 5-week-old puppy pix it is an easy search on "week5" to retrieve pix to create an Album to peruse for brochure purposes. If "week5" instead comprises multiple deeply nested Folders subset to every litter of every Dam the process of retrieving becomes a nightmare.
    I welcome further discussion of this important topic.
    -Allen

Maybe you are looking for

  • Caching problem w/ primary-foreign key mapping

    I have seen this a couple of times now. It is not consistent enough to create a simple reproducible test case, so I will have to describe it to you with an example and hope you can track it down. It only occurs when caching is enabled. Here are the c

  • Satellite P10-804: AC adapter makes loud noises

    The power supply is periodically making terrible noises. Can it be replaced with a non Toshiba power adaptor ? If yes, is there anything I need to know ?

  • Is Photoshop Elements version 6 compatible with Windows 7 32 bit? 64bit?

    Is Photoshop Elements version 6 compatible with Windows 7 32 bit? 64bit?

  • External drive recognition problem

    I am having issues with my iMac recognizing an external drive. I have: iMac 5,1 10.4.11, Intel Core 2 Duo 2 GHz, 1GB Memory, PIONEER DVR-112d in a BYTECC ME-525U2FW Aluminum External enclosure connected through Firewire. The iMac initially recognized

  • Apple and WS2012R2 extrelmly slow file listing

    Hi all, I have big problem with Apple and Windows server 2012R2. I migrated data from Synology to Windows Server and if i map drive : smb://fileserver/DATA_FOLDER, everything is OK, but if i open "disk" listing of folder is extremly slow 30 folders -