How to take out units in a column

조회 수: 1 (최근 30일)
EB
EB 2020년 4월 17일
댓글: Ameer Hamza 2020년 4월 18일
I am trying to do a 3D plot where I would plot the x and y coordinates over time, but when I try to use the plot3 command, it says all of the data needs to be numeric values.
Therefore, I am trying to take out the 'sec' shown in the first column when I import my data, but am having no luck.
I tried using
>> sscanf(data, '%f')
Error Message: First argument must be a string scalar or character vector.
I tried
>> num2str(data)
Error Message: Input to num2str must be numeric.
and I tried a few other ones which I realize wasn't even going to do what I expect it to do.
  댓글 수: 3
EB
EB 2020년 4월 17일
I uploaded a sample .mat
Ameer Hamza
Ameer Hamza 2020년 4월 17일
The column 1 have class of 'duration'. See my answer to convert them to double datatype.

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 17일
out.time = seconds(out.time);
  댓글 수: 2
EB
EB 2020년 4월 18일
편집: EB 2020년 4월 18일
Awesome works perfectly!! Thanks!!
Ameer Hamza
Ameer Hamza 2020년 4월 18일
Glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by