Jump to content

Yuri33

Members
  • Posts

    42
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Yuri33

  1. You're half way there. All multidimensional arrays (both the data array and the boolean conditional array) can be flattened to a 1D array which can make use of the 1D templates that have already been created. You then reshape the filtered array to the original dimensions. I don't have access to create XNodes, but that's what I would do.
  2. You could create and maintain a parallel variant hash that indexes your original hash. The attribute names could literally be "1", "2", etc. (or just typecast your enumerators to strings) and the corresponding values would be the attribute names of your original hash. It's a bit of extra bookkeeping, but this is a fairly specialized case anyways. If you want, you could add this extra hash when certain criteria are met (e.g., # of elements, size of attribute names). Either way, you can continue to use method two without exposing yourself to large memory footprints.
  3. I believe his previous job may have had something to do with kidnapping...
  4. Even better is to use the "Panel Close?" notification event. Then you can discard the user's panel close request and perform a controlled shutdown of your program, ensuring that you can run any cleanup subVI's that you require. I actually do this for both the "Panel Close?" and "Application Close?" notification events, so that I can always ensure a proper shutdown.
  5. Rectify and smooth the signal, that way, you only get one trigger per sound packet. If you need to make things as fast as possible, pipe the processed data back into an output channel and configure the appropriate analog trigger parameters. Or alternatively, if the noise is occuring at a specific frequency, there is a single tone frequency detector VI in the signal processing palette. I believe the VI has a window size parameter, so you can have it process data in packets large enough to contain an entire packet of sounds at a time. You could then generate a software trigger when you detect your particular tone.
  6. Have you looked at the Profiler? What subVI is taking the most time, and how many calls are made to that subVI?
  7. Is there a significant hit in execution speed if a VI is opened and executed by VI Server? If that's the case, perhaps we can establish a generalized speed test framework and help people avoid some of the pitfalls of speed testing that were shown in that other thread.
  8. This is my standard LV2-based global stop: Download File:post-7607-1207603671.vi (LV 8.2)
  9. Normally, when you use system controls, you are stuck with system colors and cannot change them. LV produces an error if you try. However, using some inspiration from the JKI guys, I was able to create a set of text contols (simple string and a combo box) where I can adjust the background color of the text. I did this by modifying the classic equivelent with some system control components and some gymnastics. The result can be seen below: Download File:post-7607-1206632349.vi (LV 8.2) However, there is also a simple numeric (included in the above VI) that I wish to exhibit the same behavior. That is, I want it to look like a system numeric, but have adjustable background color like the text-based objects. Unfortunately, I haven't been able to accomplish this. Can anyone get the numeric in the above VI to act like the other text-based objects?
  10. QUOTE (Aristos Queue @ Mar 25 2008, 12:29 PM) I realize that, but if reshape array produced a sub-array, then the only reallocation is for 4 elements: pointer to original array data, new dimensions (whether more dimensions or less than original array), index (=0), and stride (=1). That would be quite efficient. Edit: I'm sorry, I just realize I was mistaken about what is stored into a sub-array. The dimensional information is not stored, only pointer, length, start index, and stride. I guess my focus was on flattening arrays, which is something I do often, and that doesn't require the dimensional information, since all flattened arrays are 1D. I've always used Reshape Array to do this, and it's bothered me that there's a buffer allocation, but AQ's explanation (new dimension information, which is stored inline with the original array) makes sense for a new buffer. Perhaps NI should consider a new array primitive that simply flattens an array--that way it can truly produce a sub-array and be quite efficient.
  11. That's the point, though. In the key binding section of the control properties, you can set page up/down for a specific control, and it will only work for that control. However, you aren't able to do this with the up and down keys. I realize that if you bind up/down to a specific control, then other numerics with increment/decrement would not be able to use the up/down keys when they have focus. But that may be the desired functionality for the program. It's just too bad that LV doesn't allow this, restricting the range of keys that can be unambiuously bound to a specific control.
  12. AQ, does this "stride" array stuff explain why there is a buffer allocation dot in "Reshape Array" even when the number of elements do not change? That has always bothered me. And as a seperate comment, I have to say that while I'm happy that NI has gone to such lengths to optimize this stuff under the hood, it seems like a lot of work for little gain in terms of speed\memory usage. As far as I know, the output of any array native that produces a sub-array (i.e., AQ's "stride "array) either goes to another array native, a non-array native, a subVI, or a terminal. If the sub-array goes to anything other than the first in that list, LV has to automatically allocate a full array before proceeding, which wipes out any gain in efficiency. So the only instances where I could see this sub-array implementation providing significant gain is when you have a whole bunch of native array operations to do consecutively with nothing else in between. Even splitting these operations up into subVI's would destrory the sub-array optimization. As soon as anything has to be done other than a change in indexing, the sub-array has to allocate a full array for itself. Or am I missing something? I do some work with sparse matricies, but I use Matlab for that because it has native functions for operations on sparse matricies, and because Matlab provides lots of complex indexing capabilities. I might be persuaded to do some of that work in LV if NI ever exposes something like this sub-array stuff to us. But I wouldn't hold my breath: the sub-array structure that AQ describes would mean that a pointer to an array in memory would be exposed, and that's a no-no for NI.
  13. I haven't done the test in a while, but I believe that the native implementation was much faster than the dll one supplied by NI (hence the reason I built the subVI). Also, while I've never needed to, the start index can easily be incorporated by selecting a different column (instead of hard-coded 0) to index from.
  14. QUOTE (Justin Goeres @ Mar 20 2008, 10:04 PM) Yes, I forgot to stipulate that my code only works when the array can be evenly divided by the decimation factor. I use that function in a program that ensures this condition elsewhere. The later modification that fixes this problem is good solution that doesn't sacrifice speed.
  15. I have absolutely no experience with LVOOP, but does this implementation actually provide TRUE parallel read functionality? Any functional global implementation obviously does not, and in most instances, that's not a big deal. However, there are still some cases where I prefer to use true globals as WORMs because you can read in parallel (reading a global does not block other reads of the same global like a functional global would).
  16. I don't know what problem would be most appropriate, but perhaps you might be willing to sponser a LabVIEW "golf" challenge. That is, instead of trying to optimize based on speed, you optimize based on some metric that measures the size of the program. In a text-based language, this typically involves counting the number of characters in the program. For LV, it's a little more complicated, but I guess the metric could # of nodes or perhaps just the size (in kb) of the program. The winning entry would be the program with the smallest "size" that still performed the propsed task.
  17. Off the top of my head, you can drastically reduce the amount of points you need to test by only using those that lie on the "convex hull" of the shotgun pattern. After that, it's probably a matter of determining the longest axis of this polygon and testing a few pairs. This approach would scale very well with vast numbers of points.
  18. When you wired the activeX refnum to the Register Event Callback node, did you try and create a Callback VI by right-clicking the VI Ref input and selecting "Create Callback VI"? Usually, LV can analyze the activeX event callback prototype and automatically create a properly formatted event callback VI with an appropriate control for the event data labeled "Event Data." If LV is still creating the variant this way, then the callback data is more complex. You're best bet then is to find the documentation for the activeX object you are communicating with. That will show you what type of data the event returns, and then you can create an equivalent LV prototype to cast the event data (using Variant to Data or perhaps Typecast).
  19. If we're talking about control references, then strict typecasting is very necessary. I mean, the whole point of this is to essentially recreate a local reference to a control object, but on that isn't restricted to the VI the object is located in, right? On a side note, I'm sure most of you have built large applications with plenty of UI that you offload into subVIs. How do you pass around global references of your top-level VI objects to these subVIs? I started out with a array of generic references, but I ran into the typecasting problem discussed above. So I settled on a true global. I suppose you could make a functional global, but it's a real pain to add\remove strictly-typed references. Plus, I'm not looking to "protect" my global from race conditions--I know I will only write to them once at the outset, and then only read from them later on. Since a functional global blocks other calls until the current one finishes, that represents an inefficiency. I want to be able to have multiple parallel reads.
  20. You're original data looks remarkably like the kind of data you get for enzyme kinematics-related research. They use a special function called the Hill equation to characterize the behavior of this relation. There are several ways to fit the data, most involving taking the logarithm of the data before fitting. A quick google seach found this white paper on one particular approach for fitting the Hill equation appropriate for coding into a computer program. Once the equation is fit, you can easily calculate the slope based on the fitted Hill coefficient.
  21. I have a large application with multiple parallel loops\threads\processes\etc. One of these processes is and embedded instance of MediaPlayer. I wish to instigate a stop signal some time after MediaPlayer finishes playing whatever it is playing. The obvious avenue to accomplish this is to use a "Register Event Callback" node to register a callback VI to execute when MediaPlayer produces a "wmppsMediaEnded" activeX event. At this point in time, my stop signal can be instigated by generating a user event in the main VI (cleverly named "Stop") which begins stopping all the parallel processes. (Note: I'm not splitting the user event registration accross several event nodes or anything like that--the Stop user event just calls a bit of code that changes several "state" LV2 globals which put the parallel loops into an "idle" state). Therefore, I added the User Event refnum as a User Parameter when registering the callback VI. In the callback VI, I simply generate the Stop event, and everything stops. All this works fine. The problem is that I wish to create a delayed stop, say 5 seconds after the "wmppsMediaEnded" event occurs. When I try to add a wait in the callback VI itself, it freezes everything in the main VI, including all the parallel loops. It seems like the callback VI stops all other LV processes and the main VI must wait until the callback VI finishes executing. Is there any way to create a non-blocking callback VI?
  22. QUOTE(Aitor Solar @ Jan 21 2008, 05:55 AM) Is this confirmed to work? You can simply typecast a generic control reference to a strictly typed reference? Will this work at run-time (in LV8.2)?. I would love to change my application back to the way I originally had it (and slay the last global!), but I don't want to put the time in if I'm going to run into the error again at run-time. QUOTE(Aitor Solar @ Jan 21 2008, 05:55 AM) Well, in LV8.5 it works fine, just like other control types . Yes, the NI engineer kept trying to get me to upgrade. I'm using a university license for LV, and they're slooooooow to offer the lastest version
  23. If you just want a raw pixel count, the simplest way would probably be to convert the ROI to a mask using "IMAQ ROI to Mask" and then input that mask into "IMAQ Quantify" or "IMAQ Particle Analysis." I don't know if you have access to these VIs in the evaluation version of LV, however. You may need the Vision module. I believe you can download it for free and use in evaluation mode for 30 days.
  24. QUOTE(guruthilak@yahoo.com @ Jan 17 2008, 10:06 PM) Instead of wiring to the value (signaling) property, which produces a value change event, you can instead wire to the value property, which will change the boolean to whatever you want without triggering a value change event.
×
×
  • Create New...

Important Information

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