LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continues process

Dear forum members, help me to find error of my program. I have continuesly program and inside got original array which generated, but i want to modify array after view by graph, and for array modify i put condition. Now i am writing by details....
 
For example every array start from 0,1,2,3,.....i-1,i..... numbers. In this program i need to compare 'i-1' and 'i' everytime.
If abs([i-1]-[i])>0.3  [i] change to  [i-1]; "i=i-1", other case continue ....i-1, i, i+1, ....). Please see this attached Vi and help me to find out my mistake...
If possible please change my mistake on Vi.
 
Thanks in advance
With warm regards
Harut!
0 Kudos
Message 1 of 16
(3,296 Views)

Hi Melikan,

Right now you keep one array - the Original values.  On each loop, the top array (Charted[]) is replaced with the Original array - then the last element is (possibly) modified.  Maybe what you want to do is maintain two arrays - Original[] and Changed[](?)  If so...

On each loop, append a value to each array.  Simply append the random value to the Original array and don't modifiy if further (just wire it to shift register.)  Before appending a value to Changed[], decide what value to add.  You should not need to use "delete from array" and "insert into array"!Smiley Happy

I'm very confused as to what this algorithm is accomplishing, but we can certainly simplify the code!Smiley Happy

By the way, is this schoolwork?

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 16
(3,282 Views)

Why didn't you continue the original thread ?

It is not polite to start new threads, especially with a vi of 800Kb !

0 Kudos
Message 3 of 16
(3,275 Views)
This should be the code, if i understand correctly.
Allthough i don't understand what you are trying to do inside the case structure.
Maybe you could give an example with a few (3-4) numbers.
 
0 Kudos
Message 4 of 16
(3,273 Views)


Melikyan wrote:
For example every array start from 0,1,2,3,.....i-1,i..... numbers. In this program i need to compare 'i-1' and 'i' everytime.
If abs([i-1]-[i])>0.3  [i] change to  [i-1]; "i=i-1", other case continue ....i-1, i, i+1, ....). Please see this attached Vi and help me to find out my mistake...

One problem in your description is the fact that you  don't distinguish between the index of an array element and the value of an array element.

If you say " [i] change to  [i-1]; "i=i-1" " does that mean that you want to replace the last value without incrementing the array size OR do you just want to Not insert the new element, keeping the array size at i-1.
 
In other words, does the index change or does the value change (or both)?
If the values of the input array is [1, 2, 3, 3.1, 3.2, 3.3, 5, 7, 8], what should the output array be?
 
We cannot solve your problem unless you provide clear specifications. 🙂
0 Kudos
Message 5 of 16
(3,249 Views)
Anyway, if you constantly want to compare the current element with the previous element, you should simply keep the current value in a shift register. It just complicates things in you read it out of the array at the next iteration.
 
 
 
Here's a quick draft that shows the idea how to arrange the shift registers. (Since I don't fully understand your problem description, the rest of the code is probably wrong, so ignore that! ;)).
 


Message Edited by altenbach on 06-29-2008 09:54 AM
Message 6 of 16
(3,246 Views)
Thanks to Pnt's post it seems this is not schoolwork - here's how I'd approach this: (with reservations Altenbach already expressed)
Comparing the newest raw value to the previous raw value seemed odd to me, so there's an option to compare the newest value to the last value actually retained in the Filtered array.
Cheers!


Message Edited by tbd on 06-29-2008 12:03 PM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Message 7 of 16
(3,244 Views)

Dear Veterans thank you for your help. Sorry i didn't write my problem by details and made it complicated for you.

I tried your Vis, but it doenst work like i want...

In this attached Vi i tried to write explanation and 1example for finit case. Here array size is 9,(but in real time case array size everytime extending) i put this for example, because inside of this program i tried to write what i want. I think now you fully can understand my problem.

With warm regards

Harutyun Melikyan!

0 Kudos
Message 8 of 16
(3,214 Views)
OK, so you just want to substitute the previous data point for any outlier, keeping the array the same size.
 
Here's a quick solution for this, see if this suits your needs.
 
 
(Your code is extremely convoluted and inefficient. There is no reason to delete the undesired element and then insert a new element with the correct value. All you need is replace the value. (resizing an array (delete from array, insert into array) are both very expensive, because they force a new copy of the entire array in memory.
 


Message Edited by altenbach on 06-29-2008 06:52 PM
Download All
Message 9 of 16
(3,206 Views)

Dear Altenbach thank you so much for your help. Please see this attached Vi. I tried to make program again. When i push run, when false keeping the raw data, but if comparision true, in that case need to change last element. In this program on Changed graph first show, but after delete, and keeping exactly raw data, why? Please tell me where is my mistake? Please run example and look 1 minute after you can understand the problem. I make default the correct data, but after next element generate, this last points changes back like raw data.

Thank you!

0 Kudos
Message 10 of 16
(3,195 Views)