I want to collect data coming from a sensor in an array. The sensor output is actualised every 1 sec. Every time a new value comes only 1 value will be stored in my array and the other values are 0.
here a simple example : 3 values injected 21, 10 and 15, I get [21 0 0] , [0 15 0 ] and [0 0 10].
I want to get this array [21 15 10] , where every value that changes is stored.
Any ideas how can I sove this problem with function or any other Note?