Cannot read data from a table to create a graph
조회 수: 2 (최근 30일)
이전 댓글 표시
Hey everyone!
I have a table with data from motor sensors, but I cannot create graphs based on the data. And I don't understand what is wrong) Could someone help me?
This is the code:

Table that I use:

Error:

댓글 수: 4
채택된 답변
Guillaume
2019년 7월 21일
The problem is that your timestamp column is text and matlab does not know how to use text as a plot variable.
I assume that the text is supposed to be a duration, if so:
sensorData.timestamp = duration(sensorData.timestamp, 'InputFormat', 'mm:ss.S') %Don't know if it's the correct format
for i = 1:4
subplot(2,2,i)
plot(sensorData.timestamp,sensorData{:,9+i})
xlabel('Time')
end
댓글 수: 2
Guillaume
2019년 7월 21일
The two files have completely different time format. Motor1_1.csv should be read as datetime directly by readtable in any recent version of matlab, so wouldn't need any conversion.
Motor11.csv having an unconventional time encoding needs the conversion as I've shown.
추가 답변 (1개)
Artur Nuritdinov
2019년 7월 21일
댓글 수: 2
Guillaume
2019년 7월 21일
Please don't post screenshots of the code. Paste the code as text.
It's a bit poor form to accept your own answer, particularly as you didn't identify the original problem. Reputation, which we only get when answers are accepted or voted on is the only reward we get for helping you.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

