Build an array with 2 values assigned to 1 dimension

I am wanting to build a 1D array where two values are assigned to each dimension.  For example:
Index 0 would have a 1 and 4 assigned to it
Index 1 would have a 2 and 3 assigned to it
Index 2 would have a 0 and 1 assigned to it.
Then I can unbundle this arrayand grab the two values for index 0, index 1, etc....  I want to put this array inside a typedef control.  Is this possible?
Solved!
Go to Solution.

Thanks for the replies.  I considered using a cluster and had the typedef control modified to include the cluster.  I may just go back to this method if this is the simplest for the code I am modifiing.
A 2D array assigns two values i.e. row and column to one number.  I need it the other way around.
Here is what I am trying to do.  I need to control a rotary valve.  I am using compact filedpoint to control the rotary valve.  The valve requires a pulse (1 then 0) for the rotary valve to move 1 position. If the valve is on channel 1 of the fieldpoint module and I want it to turn to position 2, the I send two pulses to channel 1. 
My thinking is I will have two values associated per rotary valve... a channel and a pulse value. So for example, valve 0 has a Boolean and a numeric value assigned to it in an array. Although, it doesn't have to be a boolean and a numeric.  it could be 2 numeric values for simplicity.
I hope this makes sense because without knowing this posting a VI or image is useless.  Its the chicken before the egg thing. :-)

Similar Messages

  • How to build a array with collected data

    Hi,
    I have collected data from serial port with VISA. Now I want to build a array with 100 date points. Should I connect VISA Read with Build Array directly? How to do it?
    PS: All of them are in a While Structure.
    Thank you!

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to build a array with high sampling rates 1K

    Hi All:
    Now I am trying to develop a project with CRio.
    But I am not sure how to build a array with high sampling rates signal, like >1K. (Sigle-point data)
    Before, I would like to use "Build Arrary" and "Shift Register" to build a arrary, but I found it is not working for high sampling rates.
    Is there anyother good way to build a data arrary for high sampling rates??
    Thanks
    Attachments:
    Building_Array_high_rates.JPG ‏120 KB

    Can't give a sample of the FPGA right now but here is a sample bit of RT code I recently used. I am acquiring data at 51,200 samples every second. I put the data in a FIFO on the FPGA side, then I read from that FIFO on the RT side and insert the data into a pre-initialized array using "Replace Array subset" NOT "Insert into array". I keep a count of the data I have read/inserted, and once I am at 51,200 samples, I know I have 1 full second of data. At this point, I add it to a queue which sends it to another loop to be processed. Also, I don't use the new index terminal in my subVI because I know I am always adding 6400 elements so I can just multiply my counter by 6400, but if you use the method described further down below , you will want to use the "new index" to return a value because you may not always read the same number of elements using that method.
    The reason I use a timeout of 0 and a wait until next ms multiple is because if you use a timeout wired to the FIFO read node, it spins a loop in the background that polls for data, which rails your processor. Depending on what type of acquisition you are doing, you can also use the method of reading 0 elements, then using the "elements remaining" variable, to wire up another node as is shown below. This was not an option for me because of my programs architecture and needing chunks of 1 second data. Had I used this method it would have overcomplicated things if I read more elements then I had available in my 51,200 buffer.
    Let me knwo if you have more qeustions
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    RT.PNG ‏36 KB
    FIFO read.PNG ‏4 KB

  • Show biggest index in array with value "True"

    Hello,
    Is it possible to show the maximum index number with value "true", like shown underneath?
    I can show the value on what index the series of "true" ends with the "Array Max & Min" function, but when there is
    one False between those True's, it will show the index of the True left of the False.
    I don't need to know the size of the array, because it has to stay 8
    File is attached
    Solved!
    Go to Solution.
    Attachments:
    Biggest index of array with value 1.vi ‏8 KB

    Hi Stef,
    here you go:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Build web service with value types

    Hi,
    I am trying to build a web service that uses a value type as a parameter.
    I am using wscompile and wsdeploy to build the service.
    But I don't know how to include the value type in my service.
    This is what I do:
    First I compile all the java files and put them in my build directory (incuding the value type class)
    Then I use wscompile -define -d build -nd build -classpath build config-interface.xml -model build/model.gz
    Then I create the war file that contains the class files, model.gz, web.xml and jaxrpc-ri.xml.
    Then I run wsdeploy -o dist/generic-serv.war dist/generic-service.war
    How do I get my value type class included in the wsdl file? and does it need to be in the model.gz file aswell?

    Sorry I was a bit wrong describing my problem.
    I am trying to use an ArrayList containing value types as a parameter.

  • Building an array with custom counter

    I want to use a counter as index in an array (see attached vi). I've tried to put the counter and the "energy consumption" into a txt file. That really worked well. But I don't want to use a txt file. I want to have my recorded numbers in an array, indexed by the counter so that I can go back in the vi to a specific index of the array.
    Any ideas?
    Thanks in advance.
    The German Guy
    The German Guy
    Attachments:
    Energy_consumption_simulation_counters_create txt file.vi ‏59 KB

    Hello Neighbour in the east
    What do you want to do? You want to store the 'energy consumption' in an array at a point indexed by the counter?
    In that case you have to determine what your maximum counter and your resolution should be.
    With that info you can initialize an array before the the while loop filled with NaN's.
    And with a shift register fill this array at the correct point (look out this will overwrite elements!!)
    Then afterwards you can save this array to a file, you only have to make sure to save the offset and resolution of the array as well.
    Ton
    Sorry I can't post an attachment
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Issue with building an array from a cfhttp request result.

    Here is what I am trying to do. Retrieve a bunch of results from a  REST request. Run a query to see if I should be excluding any of the xmltext entries coming back from the rest request. Build an array of the REST xmltext entries except the entries in the cfquery.
    I have it all workign except building the array minus the entries that came back in the cfquery. Here is my code so far.
    <cfquery name="getqueue" datasource="#application.settings.dsn#">
    select * from friends
    where Deactivatedate < #DATEADD('d', 1, CreateODBCDateTime(now()))#
    </cfquery>
    <cfoutput query = "getqueue">
    <cfhttp  blah blah>
    <cfset nodes_parse = XmlParse(CFHTTP.FileContent)>
    <cfset Nodes = xmlSearch(nodes_parse,'friends/friend/date/activedate/')>
    <cfset roleArray = ArrayNew(1)>
    <cfloop from="1" to="#arraylen(Nodes)#" index="i">
       <cfset NodeXML = xmlparse(Nodes[i])>
    <cfset ArrayAppend(roleArray, '[sel_members][]=#NodeXML.activedate.xmlText#&')>
    </cfloop>
    </cfoutput>
    My issue is down in the loop where I do the arrayappend. How would I build an array of values coming back from the cfhttp request but not include any of them if they match up with anything coming back from the getqueue query?

    What about the obvious? Namely,
    <cfif value_from_getqueue IS NOT value_from_cfhttp_request>
    <cfset arrayAppend()>
    </cfif>

  • Efficientl​y building an array of increasing values for a graph

    I need to build an array of values increasing by 3E-8.  Initializing an array and changing each value in a while loop works fine, but it is terribly slow.  Is there a better (faster) way of building an array of increasing values like this?

    Thanks for the suggestion, it looks like that could do what I'm looking for.  A kind tech solved the problem for me by phone -- I knew it was reading and writing the entire 100,000 element matrix to memory at each step, but I couldn't figure out how to get it to stop.  A shift register brought the run time from over 2 minutes to under 1 second.
    Thanks again for responding!
    Message Edited by Deamiter on 11-07-2006 06:46 PM

  • Populate input array with spreadsheet values

    Is it possible to populate an input array with values from a text or spreadsheet file? If so, how is it done?
    Solved!
    Go to Solution.

    Hi Joseph,
    "to be more exact":
    load the [text] file and use "spreadsheet string to array" (older LV versions) or use "read spreadsheet file" (LV8+)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Help me for build a array as follows

    Hi. I need build a array, with the number 10 in all positions of array. For example, if array is of size 10x10, the number 10 must appear in the 100 positions of array. But I need that the number  go storing in array  as follows: That store the number 10 in all row 1 of left to right, in row 2 of right to left and so on. I attached my VI, but i have a problem, the program make well the sequence but the number 10 no storing  in some positions, this positions is inthe extrems of some row,i think that i need to maintain the number of column for two cicles, buy i don't know very....Help me.!!...Thanks!! 
    Solved!
    Go to Solution.
    Attachments:
    Fotos_ejeX.vi ‏10 KB

    You said you want your array to be 10x 10, but you initialized it to only 9 x 9.
    Pay attention to where you increment your index.  You are incrementing your index before you replace array subset.  So on iteration 0, you wind up replacing at index 1 and completely missed index 0.  Increment at the end of the loop after replacing the element, not before replacing the element.
    I don't understand the comparisons to 15 and 8.  That seems like odd comparisons when you would be looking at a range of 0 to 9.  Something seems very awkward about comparing to those two numbers, and the use of 3 shift registers to track values when you are only incrementing two indices.
    Yes you don't want to increment or decrement your index on the column in the iteration where you are also incrementing a row.  So work that into your logic.
    You probably want to stop your while loop when you hit stop OR you've reached the end of your replacements.
    I would consider making two For Loops, one that iterates for rows, the inside one iterates for columns.  Shift registers on both to maintain the array.  Then use the i value of the inner loop to replace your element when you are in even rows, or the 9-i element when you are in odd rows.
    Since your indices are integer values, you should be using the blue integer datatype rather than orange floating point wires.

  • How can I build an array not knowing final size at startup?

    Hi,
    I need to be able to build an array with a certain number of rows but that number is not known at runtime. Instead it can't exceed 5 in a certain time period. So my question is: every 20 seconds I need to send out the 5 row array but if lets say 10 rows of data come in in 20 seconds I am not sure how to handle the data to have it build 2 arrays and send them out one after another at the elapse of the 20 seconds as opposed to just sending an array with 10 rows and losing half the data on the receiving side. Please any help will be appreciated,
    Alex

    I understand that you have to send a least a message every 20 seconds (could be empty ?), but can you send more messages if you get more data (e.g. 3 message of 5 rows in 20 sec) ?
    If you can, then all you have to do is to trigger the sending of a message each time the array size reaches 5, or if 20s ellapsed since last sent message.
    Here is an example, using shift registers. there is a random data generation so that you can see it working (if you set the time between data long enough, then you will see the data sent after 20 sec. Well not exactly 20 sec, but i guess you can figure this out later by yourself...)
    I hope this will be of any help
    Attachments:
    dynamic_array.vi ‏36 KB

  • Error in Release strategy : Inconsistent Characteristic Value assignment

    Hello Gurus ,
    Good Day ...
    Need your help in release strategy in purchase order .
    Thanks in advance .......
    Characteristics characteristics value
    R2R_PURCH_ORD_TYPE NB
    R2R_PURCH_GRP1 001
    R2R_PURCH_ORD_VALUE 0,00 - 1000,00 USD
    1001,00 - 2000,00 USD
    2001,00 - 10000,00 USD
    Class assigned char
    Z_CLASS R2R_PURCH_ORD_TYPE
    R2R_PURCH_GRP1
    R2R_PURCH_ORD_VALUE
    Rel grp assigned class
    PH Z_CLASS
    rel grp rel codes
    PH 1 -director/VP
    PH 2 - manager
    PH 3 - buyer
    rel grp rel strategy
    PH A1
    PH A2
    PH A3
    Now in SPRO -
    > define Release Procedures for Purchase ORder -
    > Release Strategies
    PH A1 Release Strategy 1 (rel. prereq , rel statuses, classification , rel simulation ) working fine
    PH A2 Release Strategy 2 (rel. prereq , rel statuses, classification , rel simulation )
    ERROR MSG: INCONSISTENT CHARACTERISTIC VALUE ASSIGNMENT
    DETAILS :
    You want to change the value assigned to a characteristic. However, the change causes inconsistency, so the new value is not allowed.
    The inconsistency may be for the following reasons:
    A precondition or selection condition is violated.
    The characteristic is a single-value characteristic, and different values have been set by constraints, actions, or procedures.
    In classification, inconsistencies occur when you change the value set of a characteristic if objects or classes have already been classified with values from the previous value set.
    Procedure
    Choose Inconsistencies to see what triggered the inconsistency. You can also use the explanation facility for more information.
    Delete the values that triggered the inconsistency.
    You can only change or delete a value or value set that has already been used to classify objects if you delete the existing allocations.
    PH A3 Release Strategy 3 -
    > SAME AS ABOVE
    regards,
    ajay

    Hi,
    Inconsistency  due to different "VALUE" in the Release Strategy & "VALUE" present in the Release Characteristics . Check details with value assignment with designed  Strategies.
    Also keep following VALUE Release Characteristics for  value
    <=1000,00.00 USD
    1000,00.01 USD- 2000,00 .00USD
    2000,00 .01- 10000,00.00 USD
    instead of (0,00 - 1000,00 USD,1001,00 - 2000,00 USD,2001,00 - 10000,00 USD )
    Regards,
    Biju K

  • Methods to build an array inside a For Loop.

    Let me introduce to you my nested For Loops:  
    They output a 2D boolean array depending on two 1D boolean arrays of different lengths.  This is all well and good however, in another part of my program, I want this to be a 1D array instead.
    Idea #1:
    "I'll just reshape the array at the end. Simples!"
    Idea #2:
    "Hang on, why am I using three primitives outside the loop when I can use just one inside it along with a shift register?"
    Idea #2.5:
    "Oh, wait... I remember reading somewhere about continuously building an array (with concatenate inputs) inside a loop being a bad thing and quite slow. Let me test this."
    Spoiler (Highlight to read)
    Idea #3:
    "Umm... okay, so actually the second way is faster.  I think if I initialize the shift register first then replace subsets of the array, that might also be better."
    Spoiler (Highlight to read)
    Idea #4:
    "Yep - seems much better. (Something to do with LabVIEW not having to constantly allocate more memory on every iteration of the loop)  Looking at this closer, I don't actually need the inner For Loop because of the way I'm handling the arrays.  Try again...!"
    Spoiler (Highlight to read)
    Conclusion(?) #1:
    "Well I seem to have arrived at something that looks messier, but executes about 6x faster than my initial idea. That said, the difference rapidly increases as the input arrays get much bigger (becoming orders of magnitude different)."
    Is this the most efficient way of doing what I want?  Or is there something even better (and works in LV 8.5)?
    Never say "Oops." Always say "Ah, interesting!"

    Thank you both for the feedback.  It never occurred for me to recheck the logic after I'd initially extracted the nested For Loops, but the AND gate output is obviously the same now that it's been pointed out!
    Continuing on with Idea #4, I replaced the Select with an AND then compared the times.  (also meant I didn't have to initialize one of the arrays anymore)
    Spoiler (Highlight to read)
    It appears that the AND gate was slower but then I tried with different sizes of initial arrays and in one case, the timings were 'reversed'.
    This only happened when the top array (the one that is fed into the AND gate whole) was reduced to a length in the region of 5 elements long.
    Spoiler (Highlight to read)
    Why does this happen?  Is it something to do with the AND gate possibly being optimised for single element operations so smaller arrays are handled better...?
    Never say "Oops." Always say "Ah, interesting!"

  • Passing arrays with Call Library Function does not work after application builder

    Calling a DLL with Call Library Function which requires an array of data works correctly in Labview, but after building an exe with application builder, the call no longer works.  Dereferecing the pointer in the DLL retuns all 0s and not the actual values.
    Solved!
    Go to Solution.
    Attachments:
    TEST.zip ‏28 KB

    I did not run your code because it is a little unclear to me what it does.
    Two things:
    First, is the DLL you are calling the DLL-ified version of PopUpNames.vi? Then the problem is likely that the panel is not being built into the DLL.
    When LabView builds an application / dll, it strips the front panel and block diagram from all VIs that it doesn't think need to show a panel at run time. This reduces file size and increases code security. The App Builder's panel inclusion logic can be overridden by Build Specifications -> Source File Settings -> Remove front panel. A better method is to put a property node on a control in a window you want to show marking it "visible"; this is sufficient to tell the App Builder it should keep the panel.
    Currently Source File Settings shows "no dependencies" (clearly incorrect---another evil side effect of Express VIs I guess) but if you change the settings as shown below to keep ALL panels, one might hope the App Builder can figure it to keep the panel when it deconstructs the Express VI. (Alternatively convert the Express VI into a regular one.)
    A second comment: I am a bit flummoxed at the larger goal here. You are calling LabView DLL from LabView, which doesn't make a lot of sense, so I assume your larger goal is to call LabView from C or vice-versa. In that case be aware that your DLL is x86 (32-bit) but you are passing 64-bit ints as your pointers. In this case it is 32-bit LabView with 32-bit pointers in embedeed in 64-bit containers calling 32-bit LabView with 32-bit pointers in embedeed in 64-bit containers, so it all works, but if your going to call this from C or whatnot you're going to have to follow that same design.
    When calling C code the LabView Call Library Function does have a "unsigned pointer-sized integer" data type that always appears to be 64 bits in the dev env but which actually passes a 64 or 32-bit int to the DLL depending on the environment. The "pointer sized int" has to be 64 bits in the "LabView" part of the code because LabView's strong typing requires the data type to be determined at compile time. Casting all pointers to the largest data type in LabView makes it possible to write platform-independent code, but down at the Call Library level you still have to put the right number of bytes on the stack.

  • Building an array of difference values

    Dear Forum Members,
    With reference to the attached LabVIEW 2010 Student Edition file....
    From the incoming data via the .csv 'Read From Spreadsheet' I want to display an array of the difference between the n and n-1 data value i.e. if the data set is 10, 20, 25, 35, 50 then the difference will be 10, 5, 10, 15.
    I have used the 'Index Array' function to extract the n and n-1 data values (using the 'Simulation Time' function as the Index Row incrementer) however I cannot find the way to build an array of these difference values and display them in the Front Panel i.e.
    10
    5
    10
    15
    This will no doubt be a trivial issue for those more experienced LabVIEW programmers.  Any advice or assistance will be gratefully received.
    Kind regards,
    Solved!
    Go to Solution.
    Attachments:
    Plant_Simulator (04-05-2013).vi ‏158 KB

    I'll explain what I want to do again for clarity....
    I have a simple spreadsheet file (in .csv format) that contains one (1) column of data x 800 rows (thats 800 elements).  I read the data into LabVIEW via the 'Read from Spreadsheet' function (I have already established this).  I then want to make an array that is the difference beween the n and n-1 data value.  Hence if the data set is 10, 20, 25, 50... then the difference will be 10, 5, 25..
    I want to display the difference array to screen in an indicator that shows all the difference values in one (1) column x 799 rows.  Hopefully that explains what I want to achieve.
    I tried the suggestion with the loop however there were multiple errors when this was attempted.  I cannot place the loop within the simulation frame (it doesn't allow it) hence its outside.
    Please excuse my inexperience concerning the array order(s), I find LabVIEW to be particularly unfriendly in this respect and its the source of much of my frustration and pain whenever I'm using LabVIEW to implement anything.
    Regards,

Maybe you are looking for

  • Disable-output-escaping xslt issue in Oracle 10.1.3.0

    we are using DBMS XSLT processor for transformin xml to html in oracle 10.1.3.0. When we use disable_output_escaping in the xslt, not working in oracle 10.1.3.0 . But when we use the same xslt in java xslt processor disable_output_escaping is working

  • Change "MOVE-CORRESPONDING" statement to MOVE statement in FM

    Hello Guys, I have created a datasource based on FM standard template RSAX_BIW_GET_DATA. In the source code in this template, there is a LOOP statement and below that there is a "MOVE-CORRESPONDING" statement. LOOP AT g_t_select INTO l_s_select WHERE

  • How to run servlet from JSP page

    A simple JSP page,where I will put a button.And on clicking..it will invoke the servlet and the servlet will send the result to the jsp page... Please give the instructions with examples... Thanks in advance...

  • How do I update Adobe flashplayer

    On my browser it says adobe flashplayer is out of date, when I try to install it is says it installs successfully, but still gives me the message on my browser. I've tried uninstalling, restarting, then re-installing etc. Nothing works!

  • Why are Advertisements are not being resolved?

    I've disabled all Add Ons, installed Adblock Plus, installed Malwarebyte and nothing is removing these advertisements. This issue only appears in Mozilla. You can see the images, please help. Thanks. John