## Repeat combination in matlab loop

さんによって質問されました 2018 年 10 月 21 日

### Walter Roberson (view profile)

さんによって 再度開かれました 2018 年 12 月 22 日
Bruno Luong

### Bruno Luong (view profile)

さんの 回答が採用されました

Hi I have values in column 1 (276X1) siz, wanted do it in loop and sum with column 2(12X1) , repeat to all colum 1 How can I repeat this

` Thanks in advance`

Rik

### Rik (view profile)

2018 年 10 月 21 日
@Nada I have no clue what you might mean. You should always try to provide example inputs with desired outcome, preferably also the code that you tried, why it fails and what you've tried to solve it. If you provide code, make sure to have it formatted correctly (with the {}Code button) and make sure it can be run without any external files that you did not attach.
@Madhan, maybe it is a good idea to a bit more wordy, especially in cases where the OP should provide a little (or a lot) more detail.

2018 年 10 月 21 日
this is the data

2018 年 10 月 21 日
Thank you Rik will improvise :)

サインイン to comment.

## 1 件の回答

### Bruno Luong (view profile)

2018 年 10 月 21 日
採用された回答

A = ceil(10*rand(276,1))
S = sum(reshape(A,12,[]),1)

Bruno Luong

### Bruno Luong (view profile)

2018 年 10 月 21 日
Normal, because you do not describe with a small example, then just anyone guess what you want to obtain.
Bruno Luong

### Bruno Luong (view profile)

2018 年 10 月 21 日
Again a guess (btw: you think people who helps you have plenty of time to guess what you want)
A=[1986.083
1986.166
1986.25
1986.33
1986.416
1986.5
1986.583
1986.667
1986.75
1986.833
1986.916
1987
1987.083
1987.166
1987.25
1987.33
1987.416
1987.5
1987.583
1987.667
1987.75
1987.833
1987.916
1988
1988.083
1988.166
1988.25
1988.33
1988.416
1988.5
1988.583
1988.667
1988.75
1988.833
1988.916
1989
1989.083
1989.166
1989.25
1989.33
1989.416
1989.5
1989.583
1989.667
1989.75
1989.833
1989.916
1990
1990.083
1990.166
1990.25
1990.33
1990.416
1990.5
1990.583
1990.667
1990.75
1990.833
1990.916
1991
1991.083
1991.166
1991.25
1991.33
1991.416
1991.5
1991.583
1991.667
1991.75
1991.833
1991.916
1992
1992.083
1992.166
1992.25
1992.33
1992.416
1992.5
1992.583
1992.667
1992.75
1992.833
1992.916
1993
1993.083
1993.166
1993.25
1993.33
1993.416
1993.5
1993.583
1993.667
1993.75
1993.833
1993.916
1994
1994.083
1994.166
1994.25
1994.33
1994.416
1994.5
1994.583
1994.667
1994.75
1994.833
1994.916
1995
1995.083
1995.166
1995.25
1995.33
1995.416
1995.5
1995.583
1995.667
1995.75
1995.833
1995.916
1996
1996.083
1996.166
1996.25
1996.33
1996.416
1996.5
1996.583
1996.667
1996.75
1996.833
1996.916
1997
1997.083
1997.166
1997.25
1997.33
1997.416
1997.5
1997.583
1997.667
1997.75
1997.833
1997.916
1998
1998.083
1998.166
1998.25
1998.33
1998.416
1998.5
1998.583
1998.667
1998.75
1998.833
1998.916
1999
1999.083
1999.166
1999.25
1999.33
1999.416
1999.5
1999.583
1999.667
1999.75
1999.833
1999.916
2000
2000.083
2000.166
2000.25
2000.33
2000.416
2000.5
2000.583
2000.667
2000.75
2000.833
2000.916
2001
2001.083
2001.166
2001.25
2001.33
2001.416
2001.5
2001.583
2001.667
2001.75
2001.833
2001.916
2002
2002.083
2002.166
2002.25
2002.33
2002.416
2002.5
2002.583
2002.667
2002.75
2002.833
2002.916
2003
2003.083
2003.166
2003.25
2003.33
2003.416
2003.5
2003.583
2003.667
2003.75
2003.833
2003.916
2004
2004.083
2004.166
2004.25
2004.33
2004.416
2004.5
2004.583
2004.667
2004.75
2004.833
2004.916
2005
2005.083
2005.166
2005.25
2005.33
2005.416
2005.5
2005.583
2005.667
2005.75
2005.833
2005.916
2006
2006.083
2006.166
2006.25
2006.33
2006.416
2006.5
2006.583
2006.667
2006.75
2006.833
2006.916
2007
2007.083
2007.166
2007.25
2007.33
2007.416
2007.5
2007.583
2007.667
2007.75
2007.833
2007.916
2008
2008.083
2008.166
2008.25
2008.33
2008.416
2008.5
2008.583
2008.667
2008.75
2008.833
2008.916
2009]
B = [0.083
0.166
0.25
0.33
0.416
0.5
0.583
0.667
0.75
0.833
0.916
1]
S = sum(reshape(A(:),12,[]) + B(:),1)