LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array disposition

Hello to all.
I have a problem:
I built an array of reading. csv file, from which we build the graph you can see from the attached file.
The problem is that the program places the file into the array so that the oblique lines appear on the graph (because the graph is built starting from the first hour of the last day and so on ..)
I do not know if I was clear ... I hope so. Otherwise ask.
Help me please ...

Download All
0 Kudos
Message 1 of 23
(2,997 Views)

Without the complete data (and the VI itself instead of some screenshots), there is not much to tell, but only to assume.

 

Obviously, you are using an XY graph for display and you are converting the first column to a timestamp.

These "loopbacks" in the graph indicate that you have some timestamp values more than once in the data set.

 

So please check you set of data for validity and remove redundant timestamps.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 23
(2,990 Views)

Yes! Exactly! I have some timestamp values more than once in the data set. 

My array is composed in this way:

04/07/2013 00:00 - 15

04/07/2013 00:05 - 15

-

-

-

04/07/2013 23:55 - 20

03/07/2013 00:00 - 15

-

-

-

03/07/2013 23:55 - 22

 

 

0 Kudos
Message 3 of 23
(2,983 Views)

Are the duplicate timestamps on purpose? Or are they errors in the file?

 

Before displaying the data, you have to remove the duplicates (for the Y-values as well!)

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 23
(2,978 Views)

No, there are no mistakes! It must be so.
Are surveys every 5 minutes for several days ... then the ultimate relief will be at 23:55 and the first of the next day at 00:00 and so on for more days in a row.
I think the problem may be in the order of graphing (and then display the array).
In fact, the program starts to trace the graph from 00:00 on the last day, get up at 23:55 the same day and then begins with 00:00 on the day before (for this is that the oblique line) ... and so on

0 Kudos
Message 5 of 23
(2,974 Views)

For your display, timestamp includes the date, not only the time. From the lines in your graph, not only times are redundant (which is "natural) but also dates.

For example, your screenshot shows that either 01/07/13 00:00 or 03/07/13 00:00 is a duplicate. Interestingly, both redundant dates share the same data value (15 for the 01/07 or 24 for the 03/07).

 

If you are not interested in the lines, you can also change the plot to display only the values (e.g. as cross or square). If you do that, duplicates will not be as disturbing as no unexpected line connects them....

 

Norbert

 

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 23
(2,964 Views)

In your data there are not duplicated timestamps, however as you guessed you need to build coordinate arrays with increasing timestamps.

You can do this coupling X and Y values in a cluster, then sorting the resulting cluster array, finally rebuilding the separate X and Y arrays.

The Sort 1D Array sorts cluster arrays by ordering the first element of the clusters.

See the example below.

 

Sort XY data.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 23
(2,951 Views)

Hello Paolo,

honestly I did not understand what should the example you posted (forgive me).

However, I think my problem is purely to make sure to order properly the array. That is to be able to make create the chart in two possible ways:

- The last hour of the last day back
- From the first hour of the first day forward
Do you agree? Do you have any suggestions?

0 Kudos
Message 8 of 23
(2,945 Views)

You need to sort your timestamps either in an descending (your first option) or ascending (second option) order.

However you can't simply use Sort 1D Array on the timestamps array, because you also need to rearrange the temperature values accordingly. The example shows you how to do this.

Within your loop, bundle together the timestamp and the temperature in a cluster. The generated array of clusters can be ordered (ascending) using Sort 1D array.

If you prefer the second option (descending), reverse the array after sorting (add a Reverse 1D Array function ).

You cannot graph this array of clusters directly so you need a second loop where you rebuild the timestamps and the temperatures array.

Hope this is more clear

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 23
(2,934 Views)

I'm sorry but I just can not solve the problem in this way.
Surely I do not take well the meaning of the solution you propose (I'm not very experienced). I think it would be better to try to work directly on the array created. Make sure to display the array in these two alternative ways:

- 01/07/2013 00:00 - 15 (first day first hour)
...
...
   05/07/2013 23:55 - 20 (last day last hour)

 

- 05/07/2013 23:55 - 20 (last day last hour)
...
...
   01/07/2013 00:00 - 15 (first day first hour)

is it possible?

0 Kudos
Message 10 of 23
(2,922 Views)