How can i convert .dat file values into days or months or years? Using Matlab?

1 Ansicht (letzte 30 Tage)
This is data format and i want to convert all those values into days or month or years. The values of this data-set are in mili seconds. I want to convert in to days and the add up all day energy into single cell? is it possible if it's leave me a comment thanks in advance
  1 Kommentar
KL
KL am 6 Sep. 2017
What are those values in the attached image? If they are 224.19 milliseconds, then what is the starting time of your measurement on a calender date and time.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jacob Ward
Jacob Ward am 6 Sep. 2017
Bearbeitet: Jacob Ward am 6 Sep. 2017
If I'm understanding you correctly, maybe try something along these lines:
milliSeconds = 221+3.5*rand(15006,1); % This line produces values similar to yours
days = milliSeconds./1000./60./60./24; % Converts each value into days
totalDays = sum(days); % Adds up all values to get the total days
Once you have your values in milliseconds, just convert to days by dividing and use sum(). Replace my 'milliSeconds' with whatever variable your data set is saved to.
  2 Kommentare
Furqan Jalil
Furqan Jalil am 9 Sep. 2017
Thanks I have 3 days data how to sum up values of one day into matrix? Thanks if you could help me with this query?
Jacob Ward
Jacob Ward am 12 Sep. 2017
Just put each day's sum in a different index of "totalDays"
milliSeconds = 221+3.5*rand(15006,1); % This line produces values similar to yours
days = milliSeconds/1000/60/60/24; % Converts each value into days
totalDays(1) = sum(days(1:5002)); % Adds up values from the first day.
% I'm assuming each day has about 5000 data
% points but you can change it to whatever.
totalDays(2) = sum(days(5003:10004)); % Adds up values from the second day.
totalDays(3) = sum(days(10004:15006)); % Adds up values from the third day.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by