Auto indexing and wrap around

Hallo,
when I enable AutoIndexing on a While-Loop, the node returns nothing when
the loop reads beyond the end of the array. Is there a way to change this
behaviour so, that the array wraps around and the WhileLoop reads the array
again and again and...
I could do it with a ForLoop nested within a WhileLoop but I love elegant
solutions ;-)
Regards
Oliver Friedrich

Hello Oliver,
There are several different ways you can do this depending on how you want your output to look. If you would like to repeatedly display each element of the array individually in an indicator, you can use a for loop inside the while loop, with indexing enabled on the for loop but not the while loop. If, instead, you would like to append to your array as the while loop runs so that the array grows in a repeating pattern, you can use either the build array.vi or insert into array.vi in combination with shift registers. I am attaching a simple example VI that demonstrates each of these methods.
I hope this helps!
Jyoti F.
National Instruments
Attachments:
repeating_array.vi ‏22 KB

Similar Messages

  • Auto-indexing is slow for arrays with 1 dimensions

    Hi,
    I was looking at the performance of operations on all individual elements in 3D arrays, especially the difference between auto-indexing (left image) and manual-indexing (right image, calling "Index array" and "Replace array subset" in the innermost loop). I'm a bit puzzled by the results and post it here for discussion and hopefully somebody's benefit in the future.
    Left: auto-indexing; right: manual-indexing
    In the tests I added a different random number to all individual elements in a 3D array. I found that auto-indexing is 1.2 to 1.5 times slower than manual-indexing. I also found that the performance of auto-indexing is much more dependent on the size the dimensions: an array with 1000x200x40 elements is 20% slower than an array with 1000x40x200 elements. For manual-indexing there is hardly any difference. The detailed results can be found at the end of this post.
    I was under the impression that auto-indexing was the preferred method for this kind of operation: it achieves exactly the same result and it is much clearer in the block diagram. I also expected that auto-indexing would have been optimized in LabView, but the the tests show this is clearly not the case.
    What is auto-indexing doing?
    With two tests I looked at how auto-index works.
    First, I looked if auto-indexing reorganizes the data in an inefficient way. To do this I made a method "fake-auto-indexing" which calls "Array subset" and "Reshape array" (or "Index array" for a 1D-array) when it enters _every_ loop and calls "Replace array subset" when exiting _every_ loop (as opposed to manual-indexing, where I do this only in the inner loop). I replicated this in a test (calling it fake-auto-indexing) and found that the performance is very similar to auto-indexing, especially looking at the trend for the different array lengths.
    Fake-auto-indexing
    Second, I looked if Locality of reference (how the 3D array is stored in memory and how efficiently you can iterate over that) may be an issue. Auto-indexing loops over pages-rows-columns (i.e. pages in the outer for-loop, rows in the middle for-loop, columns in the inner for-loop). This can't be changed for auto-indexing, but I did change it for manual and fake-indexing. The performance of manual-indexing is now similar to auto-indexing, except for two cases that I can't explain. Fake-auto-indexing performs way worse in all cases.
    It seems that the performance problem with auto-indexing is due to inefficient data organization.
    Other tests
    I did the same tests for 1D and 2D arrays. For 1D arrays the three methods perform identical. For 2D arrays auto-indexing is 15% slower than manual-indexing, while fake-auto-indexing is 8% slower than manual-indexing. I find it interesting that auto-indexing is the slowest of the three methods.
    Finally, I tested the performance of operating on entire columns (instead of every single element) of a 3D array. In all cases it is a lot faster than iterating over individual elements. Auto-indexing is more than 1.8 to 3.4 times slower than manual-indexing, while fake-auto-indexing is about 1.5 to 2.7 times slower. Because of the number of iterations that has to be done, the effect of the size of the column is important: an array with 1000x200x40 elements is in all cases much slower than an array with 1000x40x200 elements.
    Discussion & conclusions
    In all the cases I tested, auto-indexing is significantly slower than manual-indexing. Because auto-indexing is the standard way of indexing arrays in LabView I expected the method to be highly optimized. Judging by the tests I did, that is not the case. I find this puzzling.
    Does anybody know any best practices when it comes to working with >1D arrays? It seems there is a lack of documentation about the performance, surprising given the significant differences I found.
    It is of course possible that I made mistakes. I tried to keep the code as straightforward as possible to minimize that risk. Still, I hope somebody can double-check the work I did.
    Results
    I ran the tests on a computer with a i5-4570 @ 3.20 GHz processor (4 cores, but only 1 is used), 8 GB RAM running Windows 7 64-bit and LabView 2013 32-bit. The tests were averaged 10 times. The results are in milliseconds.
    3D-arrays, iterate pages-rows-columns
    pages x rows x cols : auto    manual  fake
       40 x  200 x 1000 : 268.9   202.0   268.8
       40 x 1000 x  200 : 276.9   204.1   263.8
      200 x   40 x 1000 : 264.6   202.8   260.6
      200 x 1000 x   40 : 306.9   205.0   300.0
     1000 x   40 x  200 : 253.7   203.1   259.3
     1000 x  200 x   40 : 307.2   206.2   288.5
      100 x  100 x  100 :  36.2    25.7    33.9
    3D-arrays, iterate columns-rows-pages
    pages x rows x cols : manual  fake
       40 x  200 x 1000 : 277.6   457       
       40 x 1000 x  200 : 291.6   461.5
      200 x   40 x 1000 : 277.4   431.9
      200 x 1000 x   40 : 452.5   572.1
     1000 x   40 x  200 : 298.1   460.4     
     1000 x  200 x   40 : 460.5   583.8
      100 x  100 x  100 :  31.7    51.9
    2D-arrays, iterate rows-columns
    rows  x cols  : auto     manual   fake
      200 x 20000 :  123.5    106.1    113.2    
    20000 x   200 :  119.5    106.1    115.0    
    10000 x 10000 : 3080.25  2659.65  2835.1
    1D-arrays, iterate over columns
    cols   : auto  manual  fake
    500000 : 11.5  11.8    11.6
    3D-arrays, iterate pages-rows, operate on columns
    pages x rows x cols : auto    manual  fake
       40 x  200 x 1000 :  83.9   23.3     62.9
       40 x 1000 x  200 :  89.6   31.9     69.0     
      200 x   40 x 1000 :  74.3   27.6     62.2
      200 x 1000 x   40 : 135.6   76.2    107.1
     1000 x   40 x  200 :  75.3   31.2     68.6
     1000 x  200 x   40 : 133.6   71.7    108.7     
      100 x  100 x  100 :  13.0    5.4      9.9
    VI's
    I attached the VI's I used for testing. "ND_add_random_number.vi" (where N is 1, 2 or 3) is where all the action happens, taking a selector with a method and an array with the N dimensions as input. It returns the result and time in milliseconds. Using "ND_add_random_number_automated_test.vi" I run this for a few different situations (auto/manual/fake-indexing, interchanging the dimensions). The VI's starting with "3D_locality_" are used for the locality tests. The VI's starting with "3D_norows_" are used for the iterations over pages and columns only.
    Attachments:
    3D_arrays_2.zip ‏222 KB

    Robert,
    the copy-thing is not specific for auto-indexing. It is common for all tunnels. A tunnel is first of all a unique data space.
    This sounds hard, but there is an optimization in the compiler trying to reduce the number of copies the VI will create. This optimization is called "in-placeness".
    The in-placeness algorithm checks, if the wire passing data to the is connected to anything else ("branch"). If there is no other connection then the tunnel, chance is high that the tunnel won't create an additional copy.
    Speaking of loops, tunnels always copies. The in-placeness algorithm cannot opt that out.
    You can do a small test to elaborate on this: Simply wire "0" (or anything less than the array sizy of the input array) to the 'N' terminal.......
    Norbert
    PS: Auto-indexing is perfect for a "by element" operation of analysis without modification of the element in the array. If you want to modify values, use shift registers and Replace Array Subset.
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Auto index only shows partial data

    Hi everyone,
    Please see the attached file.  I've added notes where the data goes missing.  I know it has something to do with auto-indexing and I spent quite a bit of time reading about it and trying different things but I really need some help now please.
    Thank you!
    Solved!
    Go to Solution.
    Attachments:
    For forum.vi ‏47 KB
    For forum.xlsx ‏12 KB

    Think about what you're trying to do.
    You have three arrays you're indexing.  Let's say they're lengths 1, 2, and 3.
    In the first iteration, we'd index 0 and get back a value from all three.
    In the second iteration, we'd index 1 and get back two values and have a bounds conflict.
    In the third iteration, we'd index 2 and get back a single value while having two bounds conflicts.
    Anything you process in the second and third iteration is garbage.  You have bad inputs so the output isn't useful to you.  In some languages, this will throw an error at runtime for indexing out of bounds.  Some will just let you process the garbage.  In no case do you WANT to run this.
    If you want to process all the elements of the array of size 3, you need to fill in values for the first to arrays to make them all have a length of 3.  Once you do that, the loop will run as you desire.  If you have auto-indexed tunnels with fewer elements than the constant you wire, they will override the terminal, as they should.

  • Auto-index only shows 9 values instead of 91

    I'm pretty new to LabVIEW and am trying to show a cluster of 91 values pulled from a text file.  Just for a test run without using actual values passed, I created a text file with the numbers ranging from 1-91 (1 number per line up to 91).  When I let it auto index and try to unbundle it after transforming it from an array to a cluster, it only shows 9 values instead of 91.  Do you happen to know how I can overcome this issue?
    I have attached the basic files.
    Solved!
    Go to Solution.
    Attachments:
    For Loop Problem.vi ‏7 KB
    SMA.txt ‏1 KB

    STigmata08 wrote:
    Thank you very much, I had no idea that you could select a cluster size from the transformation.  I am converting it to a cluster because I thought that it would be the best form to insert the data into different parts of a word template.  I am trying to build an auto reporting tool for a test sequence.
    You need to set thee cluster size, because clusters are static structures and the size needs to be known at compile time. This also makes them useless for your problem.
    To extract all lines from a file, you could use Spreadsheed string to array with a 1D string array as type and linefeet as delimiter. No need for FOR loops and complicated code. Also your sequence structure has no purpose because execution order is fully determined by dataflow anyway. Why is it there? Don't clutter the diagram with useless constructs!
    Here's what you could do. You can get any element, array subsets, etc. using array tools. These are scalable and you don't need to know beforehand how many line are in the file.
    Here's a quick draft (LV8.6)... 
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    For Loop ProblemMOD.vi ‏8 KB
    ArrayNoCluster.PNG ‏9 KB

  • Unable to create auto-indexing loop tunnel

    I am modifying a VI created by someone else, and in the block diagram there is a loop tunnel that is supposed to be auto-indexing. But when I open the file the loop tunnel is non auto-indexing and will not allow me to change it to auto-indexing (when I right click it says "Disable Indexing" but it is light gray and cannot be clicked on). When the same file is opened on another computer the tunnel is auto-indexing and the VI runs without any errors. How can I fix this problem?
    Using Labview 2013

    This normally happens when you install DAQmx before installing LabVIEW.  The DAQmx installer will autodetect what programming language support needs installed.  So you do not need to do anything special other than install the drivers after installing LabVIEW.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How do i take a image of a wine glass and wrap a image around it in indesign cs6

    How do i take and image of a wine glass and wrap another image around it!

    InDesign isn't the correct application for such a manipulation.
    If the "image of a wine glass" is a 2-dimensional image, you may be able to create the illusion of something wrapped around it in Photoshop, but there won't be any automatic solutions. Fundamentally, what you're proposing is a function of 3-D modeling.

  • Sizing of the Spine and  Full Wrap Around Cover

    Does anyone know the exact dimensions of the full wrap around effect for the front and back cover plus spine..?? I'm trying to set a background texture effect up in Photoshop but I don't know the size of the allowed spine area.
    Any help much appreciated.
    Regards,
    Anthony
    Irish MacUser & MacAddict

    What exactly are you looking for - the spine size will vary with the number of pages
    I can measure a dust cover from one of my books pretty accurately
    I can measure the hard cover but less accurately
    You can see the Apple specs here - http://support.apple.com/kb/HT3412 - but they are not detailed enough for what you want
    You can preview your book and see what it will look like - http://support.apple.com/kb/HT1040
    LN

  • Pointer Manipulation: Wrap Around/Rollover/Rotation of LabVIEW Arrays and Waveforms???

    I know we can't use pointers in LabVIEW, but I was wondering if there's any way we can do wrap-around [or "rollover," or "rotation"] of Array [or Waveform] values without having to make copies of the Array [or Waveform]?
    For instance, suppose I'm reading one second's worth of data into a five second buffer. After the first five seconds, I've got
    1st (1/5)th: 1st second's worth of data
    2nd (1/5)th: 2nd second's worth of data
    3rd (1/5)th: 3rd second's worth of data
    4th (1/5)th: 4th second's worth of data
    5th (1/5)th: 5th second's worth of data
    Now I read the sixth second's worth of data, and overwrite the [original] first second, so that I have
    1st (1/5)th: 6th second's worth of data
    2nd (1/5)th: 2nd second's worth of data
    3rd (1/5)th: 3rd second's worth of data
    4th (1/5)th: 4th second's worth of data
    5th (1/5)th: 5th second's worth of data
    and in C, or C++, I'd just move the pointer up to the second (1/5)th of data, and start from there.
    The LabVIEW Complex FFT is another place where this would be really useful. The Help File for the Complex FFT is in
    Help | VI and Function Reference | Analyze VIs | Signal Processing VIs | Frequency Domain VIs | Complex FFT.
    If you read the Help File, you see that LabVIEW returns an FFT with values in the range
    [0, 2n - 1)
    rather than the standard
    [-n, n - 1)
    i.e. LabVIEW takes the negative frequencies and tacks them on at the end, after the positive frequencies.
    I'd like to be able to view my FFTs with the negative frequencies where they're supposed to be [i.e to the left of zero], and this would be SO easy if I could just move the underlying data pointer of the Waveform forward to the halfway point.
    But, of course, in LabVIEW, I don't have pointers, so I was wondering: Are there any built-in VIs for Array [or Waveform] manipulation that will perform this sort of wrap-around [or "rollover," or "rotation"] of the data? If so, I couldn't find them. Ideally, such a VI would have two inputs: {old Array, new starting point}, and one output: {new Array}. Similarly with Waveforms, only you'd need to manipulate t0 as well.
    Or do I have to copy the entire data set to a new Array [or Waveform] each time I reach the end of the buffer?
    Thanks!

    > Ideally, such a VI would have two inputs: {old Array, new starting point}, and one output: {new Array}.
    Have a look at "rotate 1D array" in the array palette (second row, fourth column).
    (Sorry, I dont use waveform data).
    LabVIEW Champion . Do more with less code and in less time .

  • Is there an easy way to make JSpinner wrap around at max/min values?

    I have several pages with a couple dozen JSpinners to set various values - mostly numeric, but some are not.
    I would like to make them wrap around when either the max or min values are reached.
    Is there an easy way to do this?
    I was hoping for something like an "enableWraparound" property, but I haven't found such an animal.
    I suspect I could add value change listeners to all the components and do it by brute force,
    but there are too many spinners scattered around to make that an option I would like to take.
    Any suggestions?
    Thanks.

    Ok, it looks like custom spinner models are the way to go.
    Hopefully, I can create a couple that are generic enough to meet my requirements without too much pain.
    It looks like the ones I have already created will be easy enough to modify.
    Thanks for the feedback.

  • Text will not wrap around a photo in indesign cs3?

    we have tried EVERYTHING. we use adobe indesign for our school newspaper and for the past 3 days we have been trying to get one of the articles (text) to wrap around a photo.
    the photo is a simple rectangle shape. for all of the other pages, the text wraps around photos perfectly fine. but for some reason on this one page it will not wrap around any picture at all.
    of course "text wrap" is selected for the photo and we also tried going to the text frame options and unchecked ignore text wrap. that still didn't work.
    we tried putting it on "detect edges" and that also did not work. ):
    please please please if you have any suggestions, add them!!! we really need to fix this issue because this page needs these pictures!

    I just encountered the same problem, the text did not wrap around the image whatever i did. I found the solution on my problem, that i had an imagebox underneath the image, which i was not aware of. I discovered it when i deleted first the textframes and the image. After i deleted the second imagebox the text wrapped around the image as i wanted it!

  • In the Pages Program template on the 4 column page a text is wrapped around a violinist photo How do I prepare the photo for a similar result

    In the Pages Program template on the 4 column page a text is wrapped around a violinist.
    How do I have to prepare the photo to have a similar result.
    Thanks

    You need to have an image with a more or less even background or at least contrasting to the main part.
    Menu > Format > Instant Alpha > run the cursor over the parts you want to eliminate
    With the image selected > Inspector > Wrap > check Image causes wrap > click on 2nd icon > Text Fit > 2nd icon
    Play with Extra Space and Alpha to get what you want.
    Peter

  • Embedded Search Index AND Document Security?

    I'm using Adobe Acrobat Standard 8.1.7.
    It appears that I cannot have both an embedded search index and restricted security (e.g., password required to change document) on the same document.
    Why is that?
    If I start with security ON and then attempt to embed a search index, I get below error message:
    A search index can not be embedded in this document because this document has restricted security permissions.
    If I start with security OFF, successfully embed a search index, and then secure the document, Acrobat "strips off" the previously embedded search index.  No warning message; no feedback to end-user; just kills it!
    Why are those two functions mutually exclusive?  Anyone know of a work-around?
    Thank you in advance!

    Hi,
    As to "why", that might be floating out there in Adobe's devnet space or in one of the blogs maintained by Adobe's devnet crew.
    Also good to know about use of embedded index - if used, cannot apply fast web view to the PDF. It is one or the other, but not both.
    Work around? I've not come across one; but, that does not mean something isn't "out there" <g>.
    Be well...

  • Pasting images, editing, wrap around text in appleworks

    When I try to insert images into a text document in Appleworks, it will add the image, but the only thing I can do is resize it. I can't place the image where I want it to go, and I can't make the text wrap around it either.
    Also, is there a way to make flow charts, or add text to the shapes you can insert????
    Thanks!

    Hi Cristina,
    Images can be inserted into AppleWorks WP documents in two different ways—as inline objects or as floating objects.
    If AppleWorks is in Text mode when you insert or paste the graphic, it will become an inline object. These are treated as a single (large) character in the line of text, and their location is fixed relative to the text itself. Inline objects can be moved, within the line of text, by clicking on the object to select it, then dragging it to another position in the text.
    If AppleWorks is in Draw mode when the graphic is inserted or pasted, it will be a floating object. These 'float' above the text layer, and can be moved independently of the text, which flows under the object. If Text Wrap (go Options > Text Wrap) is applied to the object, the text will flow around it.
    You can change an inline object to a floating object using the following steps:
    •Click on the red toolbox at the lower left of the window to Show the Tools.
    •Click the object (graphic) to select it. A single handle will appear at the bottom right corner of the object.
    •Press command-X to Cut the opbect from the document and place it on the clipboard.
    •In the Tools, click the Selection Tool (Arrow) at the top of the Tools Palette.
    •Press command-V to Paste the graphic back into the document as a floating object.
    (•With the object still selected, go Options > Text Wrap... Choose Regular, and click OK.)
    You'll now have a graphich which can be repositioned at will, and which text will flow around.
    Regards,
    Barry

  • HTML lines wrap around in the HTML report output

    I seem to have a problem with lines wrapping around in HTML format. If the report is ran using the report builder the output will fit in every line without wrapping the information.
    While if I run the same report -- to present the info using a browser -- using JSP in HTML format, the same lines will wrap around the info in two lines.
    Here is how I send this document to the server :
    pwrmpos_n: report=pwrmpos.rep destype=cache desformat=html server=rep60_wforms2 %*
    Any help will be appreciated

    Hello Hernando,
    I am a little confused, the command that you describe is only for paper layout...
    Anyway, let's try to help you:
    - on your paper layout you specified a width for each column (when you resize it in the Paper Design window). When you run the paper layout with HTML (ot HTMLCSS) as format the width is present in the <TD> tag.
    - for the JSP, by default the HTML does not contains any size for the table and cell so the browser size the table to fit in the screen.
    If you do not want any wrapping in the JSP just modify the HTML tags to specify a width, or wrap for the TD tag.
    Regards
    Tugdual

  • How do I get text to wrap around a jpeg photo. Pages instructions don't eem to work for me,

    How do I get text to wrap around a jpeg photo. Pages instructions don't seem to work for me. I'm just beginning to use Pages for other than simple word processing.

    I am creating a photo album with captions and have tried to have one caption wrap around a photo image that is part of a series of three overlapping and descending images. I have selected the photo, clicked Inspector etc. with no luck. I did read a previous answer re floating and noticed that both my text and my image have inline in light colour and floating in dark, which I presume means they are both inline. When I try to click on Floating in Object Placement, nothing happens. The option doesn't appear to be "available", unlike the wrap options below, which do light up and indicate what I want to happen. It just doesn't happen and I don't know how to solve the problem.
    I have had to replace my older computer on which I did all of these projects (newsletters, albums, etc.) with an old version of InDesign, which no longer works with the newer OS 10.6. So I'm trying to learn how to do the same types of things with Pages, and it's somewhat frustrating, since text wrap was quite simple with InDesign.
    Stan

Maybe you are looking for