Jump to content

Wiring the 'N' terminal inside a For Loop


Recommended Posts

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

QUOTE(crelf @ Sep 13 2007, 07:08 AM)

What's truly delicious is the amount of RAM it uses for large arrays! :thumbup:

This is the process info for Example.vi in my previous post:

http://lavag.org/old_files/monthly_09_2007/post-2992-1189696774.png' target="_blank">post-2992-1189696774.png?width=400

All arrays are DBL.

Array of 1 element: 56.1 MB (roughly LabVIEW's baseline usage on my machine with this .lvproj open)

Array of 1000 elements: 80.2 MB

Array of 10000 elements: 1.3 GB and climbing when I killed the process

It should be noted that my test machine has (only) 1GB of RAM, so it entered Swap Hell a minute or so into the calculation (where the curve goes pretty flat at around 1.0 GB).

Link to comment

QUOTE(Aristos Queue @ Sep 12 2007, 11:05 AM)

I don't think that would've helped for your enum example nor Justin's wire-the-N. Those have been in LabVIEW for a long long time.

--Well, if they've been around for a long while, certainly upgrade notes is the wrong place to point these features out. But, I've been around for a long while too, (dozen years or so with LabVIEW, CLD) and both features are new (and useful) to me. I geuss that's why I aways follow the LAVA traffic, but it would be nice if the NI documentation did a better job of showing this sort of thing to us. (I'm sure both are in the documentation and I'll find details on the enum one now that I know to look, but why did it take LAVA to let me know to look?)

Best Regards, Louis

Link to comment

QUOTE(Aristos Queue @ Sep 13 2007, 11:29 AM)

This is not quite correct. If the array is an array of error cluster and if one of the error is the constant used on the BD (as unlikely as it seem) this may return the wrong result.

PJM

Link to comment

There's nothing like using a disk cache to determine array size:

post-181-1189717365.gif?width=400

I could make it polymorphic and determine the denominator by datatype, but I'm not that keen... :P

QUOTE(PJM_labview @ Sep 14 2007, 06:57 AM)

If the array is an array of error cluster and if one of the error is the constant used on the BD (as unlikely as it seem) this may return the wrong result.

Good catch!

Link to comment

QUOTE(PJM_labview @ Sep 13 2007, 04:57 PM)

This is not quite correct. If the array is an array of error cluster and if one of the error is the constant used on the BD (as unlikely as it seem) this may return the wrong result.

PJM

An error cluster won't match because the type is different, I32 vs CDB for the "error code". To be sure to have a different type, index an array element and bundle it in a cluster for variant comparison.

By the way, anyone ever wondered why error code 42 is "Generic Error" ???

Link to comment

QUOTE(jpdrolet @ Sep 13 2007, 03:48 PM)

An error cluster won't match because the type is different, I32 vs CDB for the "error code".

True, but it's noteworthy that using this method you can still get an incorrect result if you happen to have an array that contains the same element that you append to the very end of the array.

Link to comment

QUOTE(cmay @ Sep 13 2007, 07:13 PM)

True, but it's noteworthy that using this method you can still get an incorrect result if you happen to have an array that contains the same element that you append to the very end of the array.

Yeah.... I should've put a typedef'd enum into the cluster -- same trick that the GOOP Toolkit uses to create a guaranteed unique datatype. But I figured this was pretty close to sufficient, and I didn't take the time. Just pretend that I typedef'd the cluster itself -- that'll keep the variant comparison from claiming the two values are equal unless someone is deliberately trying to break the VI by using the VI's own typedef. ;-)

Link to comment

QUOTE(crelf @ Sep 14 2007, 10:02 AM)

...or use a DBL that's an NaN (NaN != NaN).

You need a comparison that would match TRUE if and only if compared the appened element. NaN will be different from all elements including the appened one.

However, while NaN != NaN, you will find unexpectedly that Variant[NaN] == Variant[NaN]. Is that a bug or a feature? It seems that variant comparison strictly requires the same type but makes a typeless comparison on flat data.

Link to comment

QUOTE(tcplomp @ Sep 12 2007, 08:05 PM)

In fairness, the NI forums didn't create the problem, it only highlighted it. I had some email communication with ben about a year ago on this subject.

If anyone knows of a method to get the array size of an array via reference, please let us know. My preferred method is casting the "VALUE" to an array of variants, and using the "Array size" on this......

Or using the OpenG version of stripping it from the variant VALUE string itself.....

Shane.

Link to comment

QUOTE(jpdrolet @ Sep 15 2007, 01:33 AM)

...while NaN != NaN, you will find unexpectedly that Variant[NaN] == Variant[NaN]. Is that a bug or a feature?

We just had a mini-debate here and came up with the answer that it is both a bug and a feature. I think that topic deserves its own thread :)

Link to comment

QUOTE(Louis Manfredi @ Sep 13 2007, 01:21 PM)

--Well, if they've been around for a long while, certainly upgrade notes is the wrong place to point these features out. But, I've been around for a long while too, (dozen years or so with LabVIEW, CLD) and both features are new (and useful) to me. I geuss that's why I aways follow the LAVA traffic, but it would be nice if the NI documentation did a better job of showing this sort of thing to us. (I'm sure both are in the documentation and I'll find details on the enum one now that I know to look, but why did it take LAVA to let me know to look?)

Best Regards, Louis

Yes upgrade notes would not have worked. They are both in LabVIEW as long as I can remember, which is about version 2.5 or maybe the parse enum wasn't in there but at least 3.0. Possibly 2.2 for Mac only, had it already too.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.