Dealing with Duration format
I have a file containing the values of the position of the body’s center of pressure, calculated during the trial. I would like to plot the time elapsed (which has the format ‘0:0:0:064’) vs the position. When I open the file (.xlsx) with "readtable", it reads me all the values as "string" and not numbers. I tried to solve this with "str2double", and while this works for the position column, is useless for the time elapsed. When I change the extension (i.e. .csv orb .txt) it converts all the durations into NaNs, even though in the "Import Data" mask it is written at the top of the time elapsed column "duration". As a result, I cannot plot the time on the x-axis.
If I run this piece of code for example:
data = readtable("AdaptationTestProva.xlsx");
x = str2double(data.x_StaticVR_RawMediolateralAxis);
y = str2double(data.TimeElapsed);
plot(y,x)
I get an empty graph.
What can I do to get a standard graph with a usable elapsed time?
If this can be helpful, I’ll leave attached an example of the file.I have a file containing the values of the position of the body’s center of pressure, calculated during the trial. I would like to plot the time elapsed (which has the format ‘0:0:0:064’) vs the position. When I open the file (.xlsx) with "readtable", it reads me all the values as "string" and not numbers. I tried to solve this with "str2double", and while this works for the position column, is useless for the time elapsed. When I change the extension (i.e. .csv orb .txt) it converts all the durations into NaNs, even though in the "Import Data" mask it is written at the top of the time elapsed column "duration". As a result, I cannot plot the time on the x-axis.
If I run this piece of code for example:
data = readtable("AdaptationTestProva.xlsx");
x = str2double(data.x_StaticVR_RawMediolateralAxis);
y = str2double(data.TimeElapsed);
plot(y,x)
I get an empty graph.
What can I do to get a standard graph with a usable elapsed time?
If this can be helpful, I’ll leave attached an example of the file. I have a file containing the values of the position of the body’s center of pressure, calculated during the trial. I would like to plot the time elapsed (which has the format ‘0:0:0:064’) vs the position. When I open the file (.xlsx) with "readtable", it reads me all the values as "string" and not numbers. I tried to solve this with "str2double", and while this works for the position column, is useless for the time elapsed. When I change the extension (i.e. .csv orb .txt) it converts all the durations into NaNs, even though in the "Import Data" mask it is written at the top of the time elapsed column "duration". As a result, I cannot plot the time on the x-axis.
If I run this piece of code for example:
data = readtable("AdaptationTestProva.xlsx");
x = str2double(data.x_StaticVR_RawMediolateralAxis);
y = str2double(data.TimeElapsed);
plot(y,x)
I get an empty graph.
What can I do to get a standard graph with a usable elapsed time?
If this can be helpful, I’ll leave attached an example of the file. #duration, #plot, #conversion MATLAB Answers — New Questions









