08-12-2005 03:42 AM
08-12-2005 03:59 AM
Hi I have found way. I wired it wrongly to updated array. Anyway. It's for anyone to read it and compare it.
Clement
08-12-2005 04:10 AM
You can
1. Cast 1D array and element to string.
2. Use Search and Replace String.vi.
3. Cast result back to your data type.
Try the attached VI.
08-12-2005 04:44 AM
ttrr, I don't think Astorboy has 7.1. BTW, why does your example have my name?
Astroboy, your algorithm is still wrong. The only reason it worked is because you have N,xxx,N,xxx. If you had two xxx's in a row it wouldn't work. Here's another option, but this is also not very good for large arrays, although ttrr's is probably better (at least for strings). You can bench them and try.
For a more complex algorithm, you can try determining the number (and indexes) of elements to remove, initializing a new array and using Array Subset on the original and Replace Array Subset on the new one. You will obviously need to calculate the length and indexes.
08-12-2005 05:00 AM
08-14-2005 07:31 PM
08-14-2005 08:31 PM - edited 08-14-2005 08:31 PM
As explaned in this recent post, it is extremely inefficient to use "delete from array" inside a loop for this purpose. You should use "replace array element" and trim the unused tail at the end. This is much more efficient!
The attached example (LabVIEW 7.0) shows a quick modification of your VI to implement this (Basically the "replace II" algoritm mentioned in the above link) . In case of large arrays, it will be much more efficient. Let me know if you have any questions. 🙂
Message Edited by altenbach on 08-14-2005 06:35 PM
11-29-2024 05:49 AM
Here !
12-01-2024 02:14 AM
Devanshi@2020 wrote:
Here !
Other than the fact that you're replying to a 19 year old thread, your solution is both inefficient (I'm guessing altenbach's comments above have some details) and not fully correct. For example, see what happens if add another 3 to your original array.