Adding items to an array of unknown size several times

Hey,.

I had an application that communicates with a device (a generator of microwave) via the Protocol modbus RS-232. It is within a state machine. The VI running generator initialization first and then move to the State 'pending', where I have a structure of the event to follow any value change of control. In the structure of the event, a timeout of 300 ms is implemented, because communication to the generator must be active at least every second (if not a defect is reported). In the case of timeout I read all record and display values.

Within this time-out I would record a value of the indicator ('measure Pfwd') several times in a 1 d table (the table size is unknown!). However, I would like for the variable to record only when the indicator 'MW?' is 'TRUE '. And "MW?" goes from 'FALSE' to 'TRUE' every time, I would like to start writing on a table from the beginning.

I tried several options, including the table to remodel, but I can't make it work. Or it works in a separate VI, but when I use it within the structure of the event and state machine, nothing works.

If someone has an idea, it would be welcome...

Thank you

Concerning

Create an another shift register which is initialized with an empty array of the correct data type and use the node Build table add data to it when you want that he added.

In BT, the size of a table doesn't have to be declared in advance.

Mike...

PS: other tunnels must be wired throughout.

Tags: NI Software

Similar Questions

  • Get the array of unknown size of the CVI code module

    I'm creating a type custom for my client, and I've encountered a problem that I'm not sure how to solve.

    Here's the situation:

    We have a custom step in which the main code is executed within a step after step. The code acquires samples of an instrument, but it is unclear how many samples will be returned. The CVI function has a table, the size of this table and an output parameter that indicates how many samples have been returned as parameters.

    void AcquireSamples (double* samples, int samplesBufferSize, int *numSamplesRetrieved)
    

    The goal is to have the array returned by the size of the number of samples taken.

    I tried several ways, none of which works completely. The problem is that, as described here, TestStand creates a temporary table to move to the code module. but it does not resize the TestStand array property. So I need to manually resize the properties of the table, and I did not understand an elegant way to do it.

    It would be easy if I had to create just a not, because I could use expressions after. I'm creating a type but I don't have that luxury (my code should allow the customer to enter expressions of post, but I run the risk of my client, removing any expression after default I get home).

    First question:

    I noticed when I was creating a stage with a CVI code module, that additional results allowed me to specify logging in both settings [in] and [out]. This I extrapolated that the parameter expression was evaluated before calling the function both again after the call to the function. I did some tests, and it doesn't seem to work that way.

    (1) this is expected behavior? I don't see it documented anywhere, if can I rely on it remains the same in future versions of TestStand?

    I used this behavior to my advantage to create an expression that does what I need an an step code module. But it does not work for a module of code to a later stage.

    I did a small test DLL file and sequence illustrates my problem. I tried to document the file in sequence to show where I'm stuck. You will need to put the DLL in one of your directories to search for the type of custom work.

    Any help would be greatly appreciated!

    I think the problem is that the C programming language does not provide enough information for a caller to know the size of an output table in any kind of standard. I recommend again, you pass a CAObjHandle which is the variable of array instead and set the table directly using CA_Array1DToSafeArray() to create a safearray and SetValVariant on the propertyobject which is the property of the table to set the table. Don't forget to free the array (using CA_SafeArrayDestroy()) that you created with CA_Array1DToSafeArray after that SetValVariant call to avoid leaks.

    Hope this helps,

    -Doug

  • Adding items to an array dynamically to the current scene

    Hello

    I created an array with n elements. After 5 seconds, I want to add an extra element in the table and display it on the screen. And that's my problem. The function is called and the element is added (as far as I can see in debug mode), but it is not displayed. I tried the playFromStart function, but it does not help (in fact, it freezes the entire application). Here is my code:
    for (j in [0..1]) {
        for (i in [0..1]) {
            insert Element {
                x: 
            } into Elements;
        }
    }
    
    def t1 = Timeline {
                repeatCount: Timeline.INDEFINITE
                keyFrames: [
                    KeyFrame {
                        time: 25ms
                        values: []
                        action: function() {
                            for (Element in Elements) {
                                //do some fancy stuff :P
                            }
    
                        }
                    }
                ]
            };
    
    def t2 = Timeline {
                repeatCount: Timeline.INDEFINITE
                keyFrames: [
                    KeyFrame {
                        time: 5s
                        values: []
                        action: function() {
                            insert Element {
                                x: random.nextInt(500), y: random.nextInt(500)
                            } into Elements;
    
                            //insert Elements into stage.scene.content;
                            t1.playFromStart(); //doesn't work...
    
    
                        }
                    }
                ]
            };
    var stage : Stage = Stage {
        title: "Test App"
        width: 500
        height: 500
        scene: Scene {
            content: [
                background, Elements
            ]
        }
    }
    What am I wrong with my code? Tips/advice, how can I get I work?

    Hello user,

    Please use bind for the changes in real time on scene.content;
    And are the timeline must always be under the nodes (code statement) whose animation you are in treatment.

    Thank you.
    Narayan

  • Clone of each element in an array of 1 d several times to create a 1 d table

    For an array of 1 d example [1,2,3,4,5,6], how to duplicate each element 5 times for example, to generate a new table 1 d as [1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6]?

    I'll give you the trick as you build your own logic.

    If you have version 2013:

    Loop for and initialize the array

    If you have the previous version:

    Loop for, initialize the array and shift register

  • Adding items in a table

    Hello guys, I looked for a solution to my problem, but I can not find the correct answer...

    Here's the thing;

    I have a variable (let's call it 'Variable Case'). Whenever this variable goes from 0 to 1, I want to add to the value of another variable (let's call this a "Defective nozzle") to an array of 2D. So far, nothing impressive, but things will get worse now!
    To be sure I added correctly the value of "Defective nozzle" in my table, I have another variable (let's call it 'Successfully added') which goes from 0 (Nothing) to 1 (the value added in the table). When 'Successfully added' is '1', I have to set the value of 'Box' return from 1 to 0 (the 'Case' variable is in a while loop which is refreshed every 100 ms so it is very important that "The case" goes to 0 as soon as 'Defective nozzle' writing is done) and once the 'case' is 0 , the value 'Successfully added' aswell 0.
    In addition, the size of the array is set to 10 items and whenever a value is written in this document, I have to increment the value of the index for the next value.

    How to understand;

    First iteration:

    • I have (from table) = 0

    • Business goes from 0 to 1

    • I insert the "Defective nozzle" value in the table

    • "Successfully added" goes from 0 to 1 (the value was written in the table)

    • I put back 'Case' to 0

    • I (index table) ++

    • 'Successfully added' move to '0 '.

    Second iteration:

    • I have (from table) = 1

    • Business goes from 0 to 1

    • I insert the "Defective nozzle" value in the table

    • "Successfully added" goes from 0 to 1 (the value was written in the table)

    • I put back 'Case' to 0

    • I (index table) ++

    • 'Successfully added' move to '0 '.

    Third generation (you have the thing...)

    I have everything works but the "I ++" thingy. Could you take a look at my vi and tell me what I'm doing wrong? Thanks for your help!

    Hello Claude,.

    meaning of GerdW, is, that you don't find the answers to many questions.

    1. Due to the paradigm of data flow of LabVIEW, independent (and not with the wire) parts of the diagram run in parallel. If the sequence you have described in your message will run not in your VI, because the structure of the case, the structure of the event and the select node are independent of each other. You see, if you perform the VI mode with the debugging light bulb on.

    2. Shared variables are not the best way to store values, except that you want to share these values with other applications on remote computers. The best way to pass values from one part of the block diagram to another is a thread!

    3. "Change the value" - event fires only if the value is passed to the user interface, this means only by the user or through the 'value (signalling)' property node. So in your VI this event never fires. And because the terminal timeout is not wired, the structure of the event you expected forever to run your loop don't cycle.

    4. The part with the select node is already described in the Rube Goldberg-Thread, this means: If TRUE then TRUE else FALSE

    I modified your VI so that he could answer some of your needs. Have a look at it and maybe you can answer the questions that came up to me:

    1. Why "table initialized" a 2D array and to what index elements must be inserted?

    2. Why 'table initialized' limited to 5 rows and 2 columns, and what happens when you want to insert multiple items? You can start again by the index 0? Do the loop terminate?

    3. If you want an unlimited size of the "initialized array", you must use the node 'build array' instead of 'subset of table to replace.

  • The delay between the "successfully added" definition affecting the value TRUE and FALSE reset is very short (about 10 ns), do you really need this information?
  • For some reason, I'm not able to view a VI. I get the message error that the extension doesn't ' corresponds to the file type.

  • Adding items to an enum shifts the constant on the BD...

    A picture is worth a 1000 words, here is my qualm:

    Why adds an element to a constant of the enum addressing the constant of the comic?

    I use a lot this approach for Pseudo-stacked sequences (I use instead a state machine) and I end up spending the enum constant after adding item wach, otherwise, it ends by disappears under what structure it is right...

    Of course, I could just right-click and use the Edit items property (which I've been using today doing my level of tolerance has ebbed down a lot lately), but unless this feature has been voluntarily integrated in LV, it is bordering the sadist.

    Tested in LV 2011.

    Hi guys,.

    Thank you for this comment! I was also able to reproduce here on my computer running LabVIEW 2011 SP1.

    This was reported to R & D (CAR # 339320) for further investigations. Please let us know if you find other problems, we like always your diligence and your comments!

  • Adding elements of an array to its previous value

    I use the VISA function of reading to read the value of my usb device. I'm the ascii values. I use the string to the array function to convert the value to its decimal equivalent. I checked the values and t works fine. The read function visa gives me table of different size each time. I need to convert it to an array of 1000 elements.i.e I'm an array whose size can be any where between 1 and 1000.If size is 1000 I want out of the while loop. If say changes the value in array for each iteration as 1,200,30,45 etc, I must cumulatively add most of the values for a resulting 1000 index value in the output array, and then exit the loop. I tried using shift registers but am stuck. Help, please


  • Added items to randomly change after opening other files in a subfolder.

    I have a file that is pinned on my Start menu that is attached to excel 2007. Now I can quickly open this file in excel when I want.

    The location of this file is \\server\sharedarea\inout.xls

    I have another file I want to pin to pin of excel area. This file is located in a subfolder of the original file.

    The location of this new file is \\server\sharedarea\subfolder\anotherfile.xls

    However when I opened the "anotherfile.xls" my pinned original file "inout.xls" has been replaced by "anotherfile.xls" and anotherfile.xls does not appear in my list of files recently viewed and or not "inout.xls".

    In order to get the "inout.xls" file that is pinned in my pinned items I open it in excel and the pinned "anotherfile.xls" link is automatically crushed and changed in the pinned file 'inout.xls'. For this reason, I am not able to get both "inout.xls" and "anotherfile.xls", pinned to the excel menu area start due to this bug. Not appear in my list of recent files either.

    I also have the same problem with task bar pinned items. If I open a folder or a file that is located in a subfolder of the original pinned item, windows, in his infinite wisdom, will replace my original pinned object, change to the new folder / file I open even if I don't want it (and 99% of the time I don't want it).

    Someone from microsoft can fix pinned bugs points because it is certainly not just me that sees a massive amount of bugs in the added items. It's something I could code and get it right the first time. It would take probably more effort to get Windows to the elements of pinned randomly change he would to leave him alone.

    I'm starting to think that the code of favorite items in Windows 7 needs a serious rewrite. So many bugs for something that really should not have problems, there!

    Thank you for the lack of support on this issue.

  • Why Event.ADDED run HGroup when you change the size of the element?

    Hello

    I was wondering why my listeners Event.ADDED/REMOVED run when I change the size of an element in a HGroup... I can't understand. Both are running.

    I am writing a card game and I want to increase the size of a card in the HGroup on mouseOver. If I comment on changes in the width and height, the listener of Event.ADDED/REMOVED is not called. It runs only when I change the size of the map. The card is a custom BorderContainer component.

    Thank you

    Gabor

    The event.target must indicate what is to be added and removed.

    Depending on the content, I suppose it is possible that the graphics have to be recalculated to display new objects and that they be deleted and added.

  • Call for ensureIndexIsVisible after adding items to the dataProvider

    Hello

    I have a strange behavior where call ensureIndexIsVisible does not show the correct item.

    Did I miss the correct event to listen to after adding items to the list data provider?

    Description:

    I use spark.components.List with a HorizontalLayout to display my data.

    My data is displayed using the ItemRenderer.

    After the addition of new elements to the dataProvider, I register the Event.RENDER and within this handler, I call ensureIndexIsVisible and cancel the registration to this event.

    Add some data to dataProvider - some elements of thousnd

    list.dataProvider.add (...)

    list.addEventListener (Event.RENDER,

    function renderHandler(e:Event):void

    {

    show index

    list.ensureIndexIsVisible (indexToShow);

    list.removeEventListener (Event.RENDER, renderHandler);

    });

    I made the debug:

    1. If I comment removeEventListener, it will eventually work after some time the event fires.

    2. the original location that I see is a few points behind so if I scroll a bit I can find the desired article

    Thank you

    Roy.

    This blog can be useful: http://flexponential.com/2011/02/13/scrolling-to-the-bottom-of-a-spark-list/

  • Problem adding items to a group after removing everything...

    Hello world

    I would really appreciate help on something. I have a group that has a few buttons in it. This group is one of the four States, and there is a component for each State. After the user runs the rest of the program and returns to this State, I want to delete the former buttons and add new buttons with new values. Bascially, I want to update the component when it is visited again. I have a problem with adding new buttons to the group when the user revisits the component / state.

    The group is created:

              <s:VGroup id="buttons"  x="0" y="35"  height="400" width="280" />
    

    When the function init for this component is called, buttons are added from an array of buttons:

    for(var i:int = 0; i < 10; i++){
              var button:Button = questions[i];
              trace(button);
              button.addEventListener(MouseEvent.CLICK, myEventHandler);
              trace(buttons);
              buttons.addElement(button);
    }
    

    When the user switches to the next State, the buttons are removed:

    if(counter == 4){
              buttons.removeAllElements();
              FlexGlobals.topLevelApplication.currentState = 'Summary';
    }
    

    When the user returns to its original state, the buttons are not added to the group as they are the first time. The trace output that each button is added is also different the second time:

    For the first time: (successfully)

    Main.MainBackground2.contentGroup.gameComp.buttons
    button8
    

    Second time:

    buttons
    button8
    

    Can someone point me in the right direction? And very good question, is there a better way I should do this?

    Is there a better way to refresh everything within a component when viewing it s second time?

    Thanks in advance!

    I don't know why you use addElement() to add buttons. You're not supposed to leave the functionality of the State to manage when the buttons must be visible? This is the way to do it in most cases. You can view a larger code example, where you have boiled down the code in a minimal example that always enhibits the question.

    If this post answers your question or assistance, please mark it as such.

    Greg Lafrance - Flex 2 and 3 certified ACE

    www.ChikaraDev.com

    Training Flex and Support Services

  • Try to restore my iPhone and I get the message "Cannot restore iPhone because an unknown error (50)." I got this message several times, how to fix?

    Try to restore my iPhone and I get the message "Cannot restore iPhone because an unknown error (50)." I can't chat because the phone is locked and I can not access my serial number. I got this message several times, how to fix?

    Have you already checked this discussion about this?

    The iPhone cannot be synced. An unknown error occurred (-50)

  • Microsoft windows media player does not retain the previous size. is irrtating so me gift of reorganize its size every time when I open it.plz help I want stable wmp version 11

    Microsoft windows media player does not retain the previous size. is irrtating so me gift of reorganize its size every time when I open it.plz help I want stable wmp version 11, version 12 is sucks.

    Hello, Simone

    I'll assume you're on Windows 7. Windows Media Player 12 is not supported on Windows Vista or XP and as such, you will need to go back to Windows Media Player 11.

    You can check the permissions in the registry to ensure that it is able to record information.

    Change the settings of the REGISTRY can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the REGISTRY settings configuration can be solved. Changes to these settings are at your own risk.

    Open the registry editor by clicking on start, type regedit.exe in the search box and press on enter, you may be prompted to continue.

    In the registry editor, navigate to HKEY_CURRENT_USER, Software, Microsoft, MediaPlayer, then Preferences.

    It should be an element named LastLocation_26, right-click on it and select Rename, and rename it to old LastLocation_26.

    Leave the open registry editor and open Media Player, then move it to your favorite place and close Media Player.

    In the registry editor, press F5 on your keyboard and check if LastLocation_26 has been recreated.

    If this is not the case, there is probably a permissions problem.

    If so, the location must be registered.

    Let us know.

    David
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Why the video file I opened several times, is associated with any player and stays as a file unknown?

    Hi, I got some video files, which do not associate with any player and stay as files being unknown, so every time when I double click on them, 'open with' opens the dialog box

    OS: Vista Ultimate 32-bit sp1,

    in the properties file type: file, when I use mediainfo tool indicates that the format of the file is mpeg-4.

    So my questions are, 1. How can I create a new association for a new format in Vista (in "associate a type of file or Protocol with a program" is not an option to create the new association), 2. why the format itself do not associate any player?

    PS: It is not a problem at all, yet I can watch the video after choosing any drive dialog box "open with."

    But I would be very grateful if I understand the reason and the solution with your help.

    diantus

    Box "Always use the selected program to open this kind of file" is not active during the opening of this file
    diantus

    ===========================
    Perhaps the following links will be useful.

    Where is past file associations in Windows Vista?
    http://ask-Leo.com/where_did_file_associations_go_in_windows_vista.html

    The creation of Vista file Association
    http://www.ehow.com/how_5796501_create-file-association-Vista.html

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • adding items from picture to picture to a worksheet string

    Hi all

    What I'm trying to do is write my data in table 1-d to text file. One problem to come my way is that he write only 10 items table in the file and I know that the dimension of the array is 10, but what I want is to add each item 10 of the table until I stop a loop by myself. Once again, I want to say I don't want 'table in spreadsheet string' of re - write but that its expansion. (without changing the size of the table). Any suggestions?

    Thank you..

    Hi NAMA,

    Please read the help for the WriteToTextFile function!

    In particular the paragraph on the entry "path of the file. It contains two options to add new data to an existing file...

Maybe you are looking for

  • YouTube can not load correctly

    I can't get Youtube to load correctly in Firefox. I don't know what happened. Flash is up to date, I've scanned for malware, I rebooted the computer, etc.. Someone at - it other suggestions as to how can I fix? A screenshot of what it looks like: htt

  • Sad, sad battery

    I got my phone a day.  I loaded entirely last night.  At 5:30 I unplugged from the charger.  I did 5 texts and checked my email once.  The rest of the time, it is in standby mode.  Now is 08:40, and the battery is dead.  This is lame! I got rid of my

  • Satellite A200 would not not turn on

    HelloI have a Satellite A200-1CR (PSAEO).I bought new 15 days ago.Last night I was listening to music for two hours, everything is ok and I stopped him and I went to sleep.Today I woke up and tried to turn it on but it died.It does nothing, I plugged

  • Discoloration of the vertical stripes on the photos

    Hello I have the HP Photosmart C4680 all-in-One, with cartiridges of original ink 300XL and 5 * HP Premium Plus Photo paper. I'm having a problem with the picture quality of some of the photos I print printing. It seems that the large surfaces of sin

  • How do I uninstall genieo

    Genieo appears when you access the internet.  trying to get rid of him.  It is not listed in Control Panel uninstall