Formula to change X-axis Values

Support questions for Flow CSV Viewer and Editor.
Ulrich76
Posts: 14
Joined: Sun Aug 06, 2023 1:57 pm

Formula to change X-axis Values

Post by Ulrich76 »

Sorry for my question, but I am new in using the Flow CSV Editor and I am looking for a solution to convert the standard x-axis to a time axis applying a formula.

The standard X-axis stepvalues should be multiplied with a factor, in my case with 0,005.
Can anyone help me with an example, to do so?

Many thanks in advance
Waveworks
Posts: 169
Joined: Thu Sep 05, 2019 1:05 pm

Re: Formula to change X-axis Values

Post by Waveworks »

Hello,

You can use the special variable t, which refers to the sample number, in your formula to accomplish this. In your case, enter the formula time = 0.005 * t, which gives you a new variable time. Then drag the time variable onto the X axis, or right-click it and select Show On X Axis. Hope this helps!

Best regards,
Gustaf
Ulrich76
Posts: 14
Joined: Sun Aug 06, 2023 1:57 pm

Re: Formula to change X-axis Values

Post by Ulrich76 »

Hello Gustav,
yeah, it works : time=0.005*t

Thank you very much.

Ulrich76
Ulrich76
Posts: 14
Joined: Sun Aug 06, 2023 1:57 pm

Re: Formula to change X-axis Values

Post by Ulrich76 »

Hello Gustaf,

if I may ask an additional question:

To modify the Y-axis values, the formula y=y/3 is not accepted. What is the formula to modify the Y-values?
Waveworks
Posts: 169
Joined: Thu Sep 05, 2019 1:05 pm

Re: Formula to change X-axis Values

Post by Waveworks »

Hello again Ulrich,

You can't really change the Y axis as such, but you can scale individual variables. You have two options:
  1. Either you define a scaled version of the variable with a formula like y_scaled = y / 3. After that you can uncheck the Display checkbox of the original variable and look at the plot of the scaled version.
  2. Or you scale the actual values of the variable. In this case you need to right-click the variable and select Redefine..., and then you can write your formula y = y / 3, which will scale the values. Be careful though - if you save the file afterwards, the values will also be scaled in the CSV file.
Best regards,
Gustaf
Ulrich76
Posts: 14
Joined: Sun Aug 06, 2023 1:57 pm

Re: Formula to change X-axis Values

Post by Ulrich76 »

Hello Gustaf,

many thanks for your detailed and fast response.

I do it per redine and it works, great!

Best regards
Ulrich76
Ulrich76
Posts: 14
Joined: Sun Aug 06, 2023 1:57 pm

Re: Formula to change X-axis Values

Post by Ulrich76 »

Hello Gustav,

While using the viewer intensively, I encountered a problem. I use an SD-Card and send from my program the following to store it on SD-Card:

Print #100, Date; ",";Time; ","; Long

By presenting the SD-Card file (it is a '.csv type) to the viewer, all variables are recognized as strings, although Long is a 4 byte variable and only Date and Time are defined as Strings by my programm .

However, if the following is sent to the SD-Card, and presenting the stored file to the viewer, the Long value will be recognized as an integer as it should.

Print #100, Long; ","; Date; ",";Time

What is the reason? What should I do, that such variables, are recognized as integer. Must they always have to be placed at the beginning of a transmission to be stored on SD-Card?

Many thanks in advance
Waveworks
Posts: 169
Joined: Thu Sep 05, 2019 1:05 pm

Re: Formula to change X-axis Values

Post by Waveworks »

Hello again Ulrich,

I need a bit more information to figure what's going on here. Can you please send me the 4 first lines of each file, so I can see exactly how they're formatted?

In general, the Viewer determines the variable types by looking at the the format of the data in the columns. If for a given column only one row contains a non-numeric character, that column will be taken as a string column. The order of the columns has no influence on the type detection. However, if the Viewer determines that the first row is a header row with variable names, this row will of course not affect the type. Here's where it may get a bit unpredictable, because the algorithm to auto detect header rows is quite complicated. That's why I would like to see both the first row as well as a few data rows for both files.

In Preferences under the CSV Import tab, you can always change the various settings from Auto Detect to the setting that matches your CSV files. That should make the import more robust.

Best regards,
Gustaf
Ulrich76
Posts: 14
Joined: Sun Aug 06, 2023 1:57 pm

Re: Formula to change X-axis Values

Post by Ulrich76 »

Hello Gustav,
many thanks for the fast reply. Now I understand a little bit more concerning my interpretion.

According to send you the first 4 lines: which should be the format of these lines, Exel, jpg picture or Flow CSV Viewer excerpt?
Is this transfer possible in this forum? And what may be the way to send such informations as attachment. I am a very newbie here.

But ahead some more additional informations regarding the 4 lines:
The first line are strings showing header lines for the table listing.
The second line is also a string giving information about the values, like date, time, frequency which the following table presents.
The third line and the following vertical table lines show, what the table values contain, that are i.e.18:09:2023, 9:09, 505 contain, the first two values (date and time) are strings and the last values i.e. 505 are integers.

The table exists of only 3 rows in horizontal and hundreds of lines in vertical direction.

As send in the question before, when changing the integer value to the first row position, still before date and time, only then the viewer accepts it as an integer value.

The purpose of the measurement is to catch the variation of mains-frequency in the boundaries of 50,6 Hz and 49,4 Hz. And in order to avoid single variables, the frequency values were multiplied by 10 before sending to the SD-Card, only to get integer values. (50,5 x10=505)

May be that this can help you to interpret my confusion.

Best regards
Ulrich
Waveworks
Posts: 169
Joined: Thu Sep 05, 2019 1:05 pm

Re: Formula to change X-axis Values

Post by Waveworks »

Hello again,

About the first 4 lines, I thought you could simply open the CSV file in a text editor, copy the first four lines and paste them into a message here in the forum. Is this possible?

Thank you for the additional information. I suspect the second row could be causing your problems, because Flow expects your data to start by the second row, and may therefore decide data types from it. However, Flow can ignore rows starting with a # sign: Go to Preferences under CSV Import and check the checkbox Ignore rows starting with #. Now, if you add a # in the beginning of the second row when you write the CSV files, Flow should ignore this line and not use it to determine data types, so maybe this would solve your problem.

If this doesn't help, please send me the 4 lines of both the working and not-working CSV files (copy and paste text into the forum message), and I'll see if I can figure out what goes wrong.

Best regards,
Gustaf
Post Reply