LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do like this with array?

How to do like this with array?

I have 2 constants array put in main while loop ( array1{6,6}; array2{4,4} ). Those arrays will be come the input data for st in the small while loop inside.

The input data look like : [6,6],[4,4],[6,6],[4,4]...... I have to put input data to result array[8]. The method is:

input data result data

[6,6] --------------------------------------------> [6,6,0,0,0,0,0,0]

[4,4] --------------------------------------------> [6,6,4,4,0,0,0,0] ( this period, just add each element in new array)

[6,6] --------------------------------------------> [6,6,4,4,6,6,0,0]

[4,4] --------------------------------------------> [6,6,4,4,6,6,4,4]

[6,6,4,4,6,6,4,4] ( 1st period )

When the las index of result data array is filled in, I have to collapse the result data array to be this array:

----------> collapse: [6,4,6,4,0,0,0,0] ( take the average of 2 continuous element add to new result data array)

Next input data

[6,6] --------------------------------------------> [6,4,6,4,6,0,0,0]

[4,4] --------------------------------------------> [6,4,6,4,6,4,0,0] ( this period, add the average of 2 continuous elements in new array )

[6,6] --------------------------------------------> [6,4,6,4,6,4,6,0]

[4,4] --------------------------------------------> [6,4,6,4,6,4,6,4]

[6,4,6,4,6,4,6,4] ( 2 nd period)

----------> 2nd collapse [5,5,5,5,0,0,0,0] ( take the average of 2 continous element add to new result data array)

Next input data

[6,6] ....wait until input data has 4 elements

[4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,0,0,0]

[6,6] ....wait until input data has 4 elements

[4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,0,0]

[6,6] ....wait until input data has 4 elements

[4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,5,0]

[6,6] ....wait until input data has 4 elements

[4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,5,5]

[5,5,5,5,5,5,5,5] ( third period )

----------> 3rd collapse [5,5,5,5,0,0,0,0]

..........................................

This wayl to make the tren graph.I  made  an VI to do that , but it's not yet correct.

 

 

 

 

 

 

 

 

Download All
0 Kudos
Message 1 of 4
(3,212 Views)

Frankly, I don't understand your problem description or your VI.

In the description, the output array has a fixed size of 8 elements, is this correct? In this case you should initialize an array of 8 elements and do all operations "in place". I don't udnerstand the purpose of all the other code.

There are a lof of things that don't make any sense at all.

  • The second largest loop has no purpose, because it iterates only once per call
  • Sometimes you are concatenating an empty array to an existing array. This makes no difference.
  • Why is some of your data EXT representation???
  • What's up with complicated constructs such as that small loop shown in the picture. I show a somewhat simpler alternative.

Anyway, I have a hard time understanding your description. What should happen at the end? Do you have a link to a website that describes the algorithm? Does the algorithm have a name?



Message Edited by altenbach on 01-10-2008 09:55 AM
Message 2 of 4
(3,177 Views)

Hi altenbach ,

Thanks for your advice, i fixed it and tried some thing, it works!  Thanks alot for ur help!

0 Kudos
Message 3 of 4
(3,137 Views)
For understanding: the thread is related to this one!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(3,133 Views)