Hello, I'm importing a large text file and trying to plot the values over time. but every time i go to plot the data I get the error: 'vectors must be the same lengths' the data is very large and I want to plot it over 5 seconds. i named the imported data s2. Please help. thanks
t = 0:.01:5
plot(t,s2)

 채택된 답변

rantunes
rantunes 2015년 3월 3일

1 개 추천

Hey,
your file s2 has only one column? Try to make length(s2). It should be the same as length(t).
Greets

댓글 수: 5

Joseph
Joseph 2015년 3월 3일
yes it only has one column. can you explain a little more?
rantunes
rantunes 2015년 3월 3일
What I mean is that, if length(s2) is not the same as length(t) you get this message error 'vectors must be the same lengths'. To plot it, you have to have the very same number of elements in each vector.
Please type down on the Command Window length(s2) and length(t) and let me know if you get the same number.
Joseph
Joseph 2015년 3월 3일
great! that worked when i got them to match up. but i also want the data points to not be connected. is that possible?
rantunes
rantunes 2015년 3월 3일
What do you mean "not connected"?
For sure if you want to plot something in a given interval, the points of this interval have to have a correspondence to the values of the function. And Matlab works on that basis. Let's put in other terms: you cant plot vectors of different sizes, and we have to live with it!
Joseph
Joseph 2015년 3월 3일
thanks

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2015년 3월 3일

댓글:

2015년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by