Re: creating an array by inserting 51 set of different values - labview
This is a discussion on Re: creating an array by inserting 51 set of different values - labview ; You could do something like in the attached image. The autoindexing output tunnel will automatically create an array of all values.
 
<img src="http://forums.ni.com/attachments/ni/170/289215/1/2PIover50.png"> Message Edited by altenbach on 12-08-2007 12:00 AM
2PIover50.png:
http://forums.ni.com/attachments/ni/.../2PIover50.png...
-
Re: creating an array by inserting 51 set of different values
You could do something like in the attached image. The autoindexing output tunnel will automatically create an array of all values.
<img src="http://forums.ni.com/attachments/ni/170/289215/1/2PIover50.png"> Message Edited by altenbach on 12-08-2007 12:00 AM
2PIover50.png:
http://forums.ni.com/attachments/ni/.../2PIover50.png
-
Re: creating an array by inserting 51 set of different values
Constant folding existed for a long time, but it got enhanced in recent versions to include more complex structures. A relatively new feature is the ability to show the constant folding graphically as in my image. (off by default).
The memory impact is often not as big as you might expect because there is also compression. How do you explain the following variation? 
<img src="http://forums.ni.com/attachments/ni/170/289223/1/foldedmemory.png"> Message Edited by altenbach on 12-08-2007 10:06 AM
foldedmemory.png:
http://forums.ni.com/attachments/ni/...ldedmemory.png
-
Re: Re : Re: creating an array by inserting 51 set of differentvalues
First you are not bothering...!
It is not required.. if you don't do it manualy, Labview will do it for you... and it will display a small red dot at the input of multiplier.. try it.
It is a good programming practice , although at this example it has no difference ...
PS: Hey now i can rate an answer :smileyhappy:
-
Re: Re : Re: creating an array by inserting 51 set of differentvalues
It is not really required, but it is slightly more efficient. You can leave it out and it will coerce at the multiply primitive automatically. The difference is minimal in this case.
The red coercion dot will tell you that a coercion takes place. If you are dealing with huge data structures and are worried about performance it is always worth to go over the code, look for coercions, and eliminate them if possible. Often they arise from careless programming.
Look at the following variation where the difference would be more dramatic. If you don't convert inside the loop, it will generate a I32 array which it will need to convert to a DBL array at the multiply node. If you convert inside the loop, you save the memory allocation of the I32 array.
<img src="http://forums.ni.com/attachments/ni/170/289231/1/coerceIt.png">
Again, an array with 50 elements is peanuts on any scale, but if you stop and think for a second whenever you see a red dot, it will be a useful habit once you start to deal with huge projects. 
Message Edited by altenbach on 12-08-2007 11:56 AM
coerceIt.png:
http://forums.ni.com/attachments/ni/...1/coerceIt.png
-
-
Re: Re : Re: creating an array by inserting 51 set of differentvalues
Pnt wrote:
if I rate an answer no stars apear on the left .. !?
Since the board upgrade a few weeks ago, there is a delay before stars appear. See:
<a href="forums.ni.com/ni/board/message?board.id=130&thread.id=3890&jump=true" target="_blank">forums.ni.com/ni/board/message?board.id=130&thread.id=3890&jump=true</a>
-
Re: creating an array by inserting 51 set of different values
nrp wrote:Now, your reply with the large loop count intrigues me! How is the VI compressed? If I tinker around with the loop mathematics, i.e. putting in weird functions like sin(x)/x it does not seem to have any effect. (Although I did manage to get LV 8.5 to crash on me once after taking quite a long time to save, saying out of memory, so maybe I fooled it once?)I give up, what is going on???
LOL, Frankly I don't know any of the details, just base my statements on observations I made over the years. A couple of version ago, VIs became significantly smaller on disk, so it seems some of the contents are compressed to get rid of the hot air. 
In this particular case, I don't think the contents of the folded array are stored on disk, but maybe the loop is precalculated when the VI loads instead of when it is run. (You migh say that storing the instructions to create the folded array is probably one of the most efficient special purpose compression algorithms known to man.
"Uncompressing" during loading of the VI just executes the loop code, right?).
If you would turn one of the loop input diagram constants into a control, you'll see that the memory footprint will be smaller by the size of the folded array. The memory buffer for the folded array is not re-used.
The LabVIEW developers have quite a few rabbits in their magic hat and some of these things change between versions. Let's just be grateful that it works as well as it does. 
Similar Threads
-
By Application Development in forum labview
Replies: 0
Last Post: 12-08-2007, 04:40 AM
-
By Application Development in forum XML SOAP
Replies: 2
Last Post: 11-06-2007, 05:17 PM
-
By Application Development in forum XML SOAP
Replies: 2
Last Post: 10-25-2007, 10:11 AM
-
By Application Development in forum labview
Replies: 0
Last Post: 10-17-2007, 12:10 PM
-
By Application Development in forum Commerce server
Replies: 3
Last Post: 08-18-2005, 12:10 PM