why the repeated number is lost?
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to synchronize 95 time series data, the code is:
combination=combnk(1:95,2) *
for k=1:length(combination)* %% k equals 1:4465 %%
m=combination(k,1) %%% Here is the problem. since k=1:4465, I would suppose m has 4465 elements but it turns out just has 94 elements. I would like to know how can I make 'm' display all elements in combination(k,1) but not lost those repeated ones%%%
n=combination(k,2)
tsa=vts(1,m)
tsb=vts(1,n)
[tsa(m),tsb(n)]=synchronize(tsa,tsb,'union');
end
%%vts is a timeseries collection which contain all the 95 time series data%%
From my code I would suppose 'm equals every element in combination first column, which should be 4465 elements. but indeed, m equals 1:94 that is 94 elements. it auto ignore repeat number like 1 is repeated 95 times in combination. I do not how to make it. Please I would like to hear all your comments. Thank you.
댓글 수: 0
채택된 답변
Elizabeth Reese
2017년 12월 8일
The k is what is looping up to 4465. The m value will take on all of the values in the first column of combination which is 1 through 94. Most of these numbers do repeat, so m will have the same value for multiple iterations of the loop while n changes. It is the pair of m and n that is the unique combination. You can look at combination in the Variable Window to confirm this.
If you are not seeing the output that you expect, I would step through the script using the debugger and check that tsa and tsb are assigned correctly and updated properly. Without having vts, I cannot check that.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!