I have the following time samples. The time is stored in a 32-bit representation which I will depict in HEX along with the corresponding timestamp.
e2 51 14 68 = 2011-03-23 11:56:33.684237 (UTC-4)
e2 51 19 6f = 2011-03-23 11:56:33.812511 (UTC-4)
e2 51 a0 42 = 2011-03-23 11:56:37.542177 (UTC-4)
e7 25 49 4f = 2011-03-23 14:11:35.261131 (UTC-4)
e7 2e 71 0a = 2011-03-23 14:12:35.257552 (UTC-4)
Any help in correlating these binary values with the time to determine format would be greatly appreciated. Please note that the clock source is different for the binary value and the timestamp, so there could be a small offset or slight variation.
Using the differences:
~0.2 seconds = 1287
~3.7 seconds = 34515
~8098 seconds = 80980237
~60 seconds = 600000
so it's just a certain number of tenths of milliseconds stored as an unsigned integer.
2011-03-23 11:56:33.684237 is around 3796964456 tenths of a millisecond, which is 379696.4456 seconds or ~4.395 days. So the origin (time 0) is 2011-03-19 02:28:17.
So in summary: The number of tenths of milliseconds since about 2011-03-19 02:28:17.
All in all it won't last long.. it seems like a short-term counter which doesn't keep track of years or months so much. Its total range is ~5 days.
I subtracted E251 1468 from E72E 710A, converted it to decimal, and got 81,616,034.
I subtracted 11:56:33.684237 from 14:12:35.257552, converting to seconds, and got 8161.573315.
I'm guessing that the format is a tenth of a millisecond counter.
E251 1468 converted to decimal is 3,796,964,456. Converting to time units, I get 105 hours, 28 minutes, and 16.4456 seconds.
I can't tell what the starting point of the count is, unless there's more than a slight variation.
Related
I've already figure out that I can divide the number of seconds/86400 and then use the format: dd \d\a\y\s hh:mm:ss, but when it goes over 31 days 23:59:59, the number of days goes back to 0.
How can I keep on going with the days (like 32 days 00:00:01)?
Thank you
---- Adding more ---
I forgot to mention that I'm trying to do it in a Pivot table and I have not been able to figure out how to use text in it...
I've also found the following format but it won't give me a 00 in the month:
Nb of seconds: 13670
Format : yy \y\e\a\r\s MM \m\o\n\t\h\s dd \d\a\y\s hh:mm:ss
will give: 00 years 01 months 00 days 03:47:50
The time is ok but it should shows 00 months.
You can split your result by whole part and decimal part and operate with them:
=INT(A1/86400) & " " & TEXT((A1/86400)-INT(A1/86400),"hh:mm:ss")
This data is in a array by the thousands. It has a negative sign where time is 0><4 hrs, and is positive where >4 hrs. The below format is "Days_hrs:min:sec.nano" Ex: 68 20:23:16.0 = 68 days, 20 hours, 23 minutes, 16 seconds, 0 ns. Please see below for an sample of the data set.
-0 0:54:38.0
-0 3:59:52.0
0 4:1:17.0
0 5:21:34.0
1 0:10:51.0
68 20:23:16.0
In another column put:
=ABS(--LEFT(A1,FIND(" ",A1)-1))+(--MID(A1,FIND(" ",A1)+1,99))
and copy down. It will create a column of decimal numbers that you can then use in other formulas.
Then you will want to format that number any way you want, like this:
=INT(SUM(B1:B6)) & " " & TEXT(SUM(B1:B6),"hh:mm:ss.0")
I'm using Matlab to read from an Excel file. I'm supposed to be reading a column of integers called Change Due. After I read the column I am supposed to be calculating the change,in Quarters,Dimes..etc
I can read the column no problem,and I understand the math of how to calculate the change. however using a condition to check the amount of change is difficult...
Problem:
I know that for Multiplication/Division of Vectors you can add a period to make it a scalar .* or ./
But how do I parse through a vector with a condition?
if(Change.<25&&Change.>=10)
I get this Error:
Operands to the || and && operators must be convertible to logical scalar values.
If I was to just simple leave the period out I would not get an error message but it only goes through the first row for calculations.
Code:
% Filename: Program_04_1
% Author: Stewart Moon
% Assisted by: No one
% Program Description:
% The purpose of this program is to demonstrate how to read from an Excel
% file and to then calculate the amount of coins it will take per row
clc % clc clears the contents of the command window
clear % clear, clears all defined variables form the Matlab workspace
close all % closes all figure windows
% Declare Variables
Quarters=0;
Dimes=0;
Nickels=0;
Pennies=0;
TotalCoins=0;
% Output of the title and author to the command window
fprintf('Output for Program_04_1 written by Stewart Moon.\n')
fprintf('\nOriginal Data read from Program_04_1_Data.xlsx\n')
fprintf('\nMinimum Number of Coins Needed to Make Change\n')
Change=xlsread('Tutorial_04_1_Data.xlsx','Coins','B4:B43'); % Reading the column in Excel and storing it the variable Change
% Output Header Format
fprintf('\nChangeDue(cents) Quarters Dimes Nickels Pennies Total Coins\n\n')
table=[Change];
disp([table])
Command Window Output:
Output for Program_04_1 written by Stewart Moon.
Original Data read from Program_04_1_Data.xlsx
Minimum Number of Coins Needed to Make Change
ChangeDue(cents) Quarters Dimes Nickels Pennies Total Coins
1
4
5
6
10
14
15
16
20
24
25
29
30
31
35
37
40
42
45
49
50
54
55
56
60
64
65
68
70
73
75
77
80
81
85
88
90
91
95
99
Calculating Change Pseudo Code:
while(Change>0)
if (Change>=25)
Change=Change-25;
TotalCoins=TotalCoins+1;
Quarters=Quarters+1;
end
if (Change<25&&Change>=10)
Change=Change-10;
TotalCoins=TotalCoins+1;
Dimes=Dimes+1;
end
if (Change<10&&Change>=5)
Change=Change-5;
TotalCoins=TotalCoins+1;
Nickels=Nickels+1;
end
if (Change<5&&Change>=1)
Change=Change-1;
TotalCoins=TotalCoins+1;
Pennies=Pennies+1;
end
end
From my understanding, you want to achieve something like:
for i = 1 : length(Change)
% your conditions using indices for the array
% example:
% if(Change(i) > 25)
% instructions
% end
end
I have two columns:
Column A: Time (seconds from midnight)
Column B: Value (arbitrary value I've created)
How would I find the average value (column B) at any instance in time(row) looking back over the previous x seconds (column A)?
Lets assume A1 = Seconds after midnight
Seconds after midnight Value
0 27
2 29
6 2
16 29
20 19
24 4
34 2
40 1
44 4
54 12
64 12
71 3
81 30
91 21
92 1
93 27
97 12
104 30
112 25
Note that time deltas are variable so I can't just look at the last x rows.
A specific question would be:
In a new column (column C) return the average Value of the last 10 seconds of data.
I have no idea how to do this. Can anyone help? It'd be greatly appreciated.
EDIT:
The output in the first 4 rows of column C would be:
Seconds after midnight Value Result
0 27 No values prior to this one
2 29 27 Average(B2)
6 2 28 Average(B2:B3)
16 29 2 Average(B4)
For each row, I'm taking the current time (16 in the last case)...going back x seconds (10 seconds in this case) and then averaging the values from all the cells in that time range (not including the current value).
My main issue is the time calculation. I don't know how to calculate it as I roll forward in time and I continue to get more instances as we move forward. If we go 10 seconds without any new data point then there would be no output since. If we got one instance in the previous 10 seconds then the output would be that value. If we got 100 instances in the previous 10 seconds, I need to return the average of that 100 instances.
Again, I'd appreciate any help, hints, links. This is driving me crazy.
Try the following formula in cell C3:
=IFERROR(SUMIFS(B:B,A:A,"<"&A3,A:A,">="&A3-10)/COUNTIFS(A:A,"<"&A3,A:A,">="&A3-10),0)
SUMIFS will get the sum of all values for which the seconds are:
less than A3 (i.e. less than 2 in this case)
more or equal to A3-10 (i.e. above -8 in this case)
And this sum is divided by the number of lines found with the same criteria.
If now there is an error (more specifically when the COUNTIFS returns 0, you would get #DIV/0!) you simply get 0 instead of the error.
Say I have a list of hours per week one is allowed to work (40, 32, 40, 40.. etc) and a large list of actual worked hours for each employee, it might look something like that:
Hours allowed 40 40 32 40 28 40 40
Worked Emp1 40 40 32 40 28 40 40 (false)
Emp2 40 40 32 42 28 40 40 (true)
I would like a single-cell formula for each employee which compares each element of the worked hour list with the corresponding element of the hours allowed list returning TRUE if there is one or more instance of worked hours being over hours allowed. So for the table above it would return FALSE for the first line and TRUE for the second one (there is one instance of worked hours being more than weekly allowed hours).
Any help would be appreciated.
Found it. Almost as soon as I posted the question I remembered the answer :)
In case if anyone is interested, the formula is:
{=SUM(--(list1>list2))}