Effacer les filtres
Effacer les filtres

Two Data Sets, one with Milliseconds in "1111" format (no periods etc.), other one with seconds in 1.111 (with period delim.), can I make them the same?

2 vues (au cours des 30 derniers jours)
Hi,
I collected data and have two different documents. One has time in the format of milliseconds with out any punctuation. For example:
1553
1566
1580
1593
1606
the other matrix has its time in seconds and with punctuation, for example:
0.0800000000000000
0.100000000000000
0.120000000000000
0.140000000000000
Besides *1000 or /1000 to get them into the same unit, I am struggeling making them the same format. Can this be done or do I have to collect the data again?
Thanks for any help.
A.
  2 commentaires
Walter Roberson
Walter Roberson le 20 Jan 2023
0.120000000000000
is it possible for any of those values to be greater than 1? Representing more than 1000 milliseconds?
You show 1553 milliseconds as an example, which would be 1.553 seconds, whereas your 0.140 and so on examples are all less than 1.
If the rule were that if the value is not an integer then it must be seconds and fractions of a second, then you would run the risk that (for example) exactly 1000 milliseconds might appear having been encoded as 1.000 but a rule checking fraction part would see no fraction there and figure that perhaps it just happened to be 1 millisecond.
Do you have the numbers grouped at the file level, before putting them all in a common place? If so then you could check whether any row had a fraction part and if so assume seconds + fraction
Terra
Terra le 20 Jan 2023
Hi,
yes, the last value for the one is 365018 and for the other 350.680000000000. The one data set is a text file from Arduinos serial monitor where I have a timestamp (the 365018 format). The other is in an excel sheet from a different machine. So if I understand you correctly, yes they are initally sepeartely grouped. I have to read up on your suggestion to fully understand it, thanks in advance.

Connectez-vous pour commenter.

Réponses (1)

Animesh
Animesh le 8 Mar 2023
Hello,
Yes, you can convert the two data sets to the same format in MATLAB. Here is an example:
Assuming you have the two data sets in variables data1 and data2, where data1 contains time values in milliseconds without any punctuation, and data2 contains time values in seconds with punctuation, you can convert them to the same format by dividing data1 by 1000 to convert milliseconds to seconds. Then, you can compare the resulting strings with the values in data2.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by