06-19-2009 10:46 AM
Hi all,
I have a problem with updating array elements and use these elements again. Okay, let me make the idea clearer. I have an one dimensional array of double. Now I am just comparing two adjacent elements. If the difference is bigger than a threshold, I need to update all the remaining elements (for instance, add 100 with all the remaining elements). And then repeat the whole things until all the elements are compared. I tried in the following way. But I am not quite sure how I use the updated array "Method 2" instead of "Method 1" in the next loop. The "In Place Element Structure" didn't help.
I know it is pretty simple in C++, where we can use the reference of the array. I am new in labview, and don't know how to do it here in labview.
Seeking your help.
BR//
Rosen
Solved! Go to Solution.
06-19-2009 10:54 AM - edited 06-19-2009 10:55 AM
Please attach the real VI, instead of a picture.
Obviously, you are new to LabVIEW and you're not familiar with most tools.
(For example, with the "in place element structure" you would need to add "array index/replace element" terminals, eliminating most of the stuff currently in there.)
I think the entire thing can be done in one simple autoindexing FOR loop with code the size of a postage stamp.
06-19-2009 11:07 AM
06-19-2009 11:16 AM - edited 06-19-2009 11:17 AM
Rosen_Infotech wrote:Hi all,
I have a problem with updating array elements and use these elements again. Okay, let me make the idea clearer. I have an one dimensional array of double. Now I am just comparing two adjacent elements. If the difference is bigger than a threshold, I need to update all the remaining elements (for instance, add 100 with all the remaining elements). And then repeat the whole things until all the elements are compared.
Most likely, you also need a shift register for the array in the outer loop, else you lose it with each iteration. Still, this all seems way too complicated.
The following code is probably not exactly what you need, but I am sure it can give you some ideas. Modify as needed.
06-19-2009 04:02 PM
Hi Altenbach,
Thanks for your prompt response. I got ur logic, but it's not that what I mean. I couldn't make it clear. I am trying again.
Do
1. Compare two adjacent elements
2. if the difference is bigger than threshhold (180)
Add 360 with all the remaining elements.
while all the elements are not finished.
Means, if there is a certain difference, it will change the remaining array elements and than start comparing with this modifyed array elements. Not adding multiple incremental numbers. I think , you get the point. Please find the attachement for sample data. Waiting for your reply.
Thanks
Rosen
06-19-2009 04:14 PM - edited 06-19-2009 04:17 PM
Have you tried just using the "unwrap phase" tool? 😄
06-19-2009 05:08 PM
Thanks a lot. This is exactly what I need. Well, is it possible to do it with modifying the input array. I mean, how I can pass array reference to a function and modify them.
However, thanks again.
06-19-2009 05:41 PM
Rosen_Infotech wrote:Well, is it possible to do it with modifying the input array. I mean, how I can pass array reference to a function and modify them.
Sorry, I don't understand your question.
06-20-2009 12:38 PM
Rosen_Infotech wrote:Do
1. Compare two adjacent elements
2. if the difference is bigger than threshhold (180)
Add 360 with all the remaining elements.
while all the elements are not finished.
If you want to write your own unwrapper (e.g. if the data is not wrapped in degrees or radians, but at some arbitrary scale), you could do something like in the attached code. Still much simpler than your first try.
See if you can simplify it. As you can see, it works with positive or negative jumps. 😉
06-20-2009 01:23 PM