Take UTC time data from excel, plot in MATlab
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have time data in UTC in an excel file that I want to plot along the x-axis. MATlab seems to have taken the data and converted it into decimal numbers, but I want to display it as it's formatted in Excel. I've tried using the datetime command, but I'm not very familier with it. Below is thow I want it formatted, the code I have, and the current plot output.
This is how I want it formatted
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1182488/image.png)
This is the code I have:
time = angleData(1:end,1);
timeUTC= datetime(time, "TimeZone","UTC");
plot(timeUTC, boreAngle)
Current output with my code:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1182493/image.png)
0 Kommentare
Antworten (1)
Star Strider
am 5 Nov. 2022
I have no idea what the problem is, however if time in‘HH:mm:ss’ format in Excel is being imported as decimal numbers in MATLAB, one option could be:
timeUTC = datetime(angleData(:,1), 'ConvertFrom','excel', 'TimeZone','UTC')
See if that does what you want. (I can’t test it because I don’t have the data.)
.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!