why the repeated number is lost?

2 visualizaciones (últimos 30 días)
bing xu
bing xu el 6 de Dic. de 2017
Comentada: bing xu el 11 de Dic. de 2017
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.

Respuesta aceptada

Elizabeth Reese
Elizabeth Reese el 8 de Dic. de 2017
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.
  1 comentario
bing xu
bing xu el 11 de Dic. de 2017
Thank you. I will do the debugger.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics and Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!