필터 지우기
필터 지우기

Making data files to the same length

조회 수: 3 (최근 30일)
Bhargavi
Bhargavi 2011년 9월 26일
I have a set of data files that starts from frame 0 through frame 'n'. 'n' varies from one file to another. When I plot my graph, my plots are of different lengths. What do I do if I want to make them all of the same length. I know there is something that we could do on Matlab, but I lost touch of it.

채택된 답변

the cyclist
the cyclist 2011년 9월 26일
>> set(gca,'XLim',[0 100])
will fix the x-axis to run from 0-100. Is that what you mean?
  댓글 수: 3
Bhargavi
Bhargavi 2011년 9월 26일
I need to cut off some extra data so that my 'n' is the same in all files and the plots have the same limit.
Bhargavi
Bhargavi 2011년 9월 26일
I defined the least and max value of X axis and plotted it. works well! Thank you so much!

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

추가 답변 (1개)

Michael Leung
Michael Leung 2011년 9월 26일
I've come across this problem too, and my method (although not the simplest, nor most efficient) is to create x vectors to match your data sets. (ie one x vector for each of your data sets) The x vector you use linspace.
ie 3 data sets, where n = 50, 100 and 500.
x1 = linspace(1,100,50)
x2 = linspace(1,100,100)
x3 = linspace(1,100,500)
hold on
plot(x1,data1)
plot(x2,data2)
plot(x3,data3)
hold off
  댓글 수: 1
Bhargavi
Bhargavi 2011년 9월 26일
But I have too many files. I can't do it for all of them one by one.

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by