LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Upadate elements of an array and reuse them

Solved!
Go to solution

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 comparedI 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.

 

 test.JPG

 

 

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

 

0 Kudos
Message 1 of 11
(3,241 Views)

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.

Message Edited by altenbach on 06-19-2009 08:55 AM
0 Kudos
Message 2 of 11
(3,237 Views)
Also show a small sample array input and the desired output.
0 Kudos
Message 3 of 11
(3,232 Views)

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.

 

Message Edited by altenbach on 06-19-2009 09:17 AM
0 Kudos
Message 4 of 11
(3,229 Views)

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

0 Kudos
Message 5 of 11
(3,207 Views)
Solution
Accepted by topic author Rosen_Infotech

Have you tried just using the "unwrap phase" tool? 😄

 

Message Edited by altenbach on 06-19-2009 02:17 PM
Message 6 of 11
(3,204 Views)

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.

 

 

0 Kudos
Message 7 of 11
(3,194 Views)

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.

0 Kudos
Message 8 of 11
(3,186 Views)

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. 😉

 

 

0 Kudos
Message 9 of 11
(3,145 Views)

Well, it seems I forgot to embed the above image. Here it is:

 

Message 10 of 11
(3,134 Views)