I have a large data set in which there are 178 recordings for every 1 second displayed in 1 row. I want to concatenate 23 rows at a time, to create rows that have 23 second time intervals. In total i need to create 500 of these 23 second rows. I have the following code for the horizontal concatenation of 23 rows:
for i = 1section1 = horzcat(data(i,1:178),data(i+1,1:178),data(i+2,1:178),data(i+3,1:178),data(i+4,1:178),data(i+5,1:178),data(i+6,1:178),data(i+7,1:178),data(i+8,1:178),data(i+9,1:178),data(i+10,1:178),data(i+11,1:178),data(i+12,1:178),data(i+13,1:178),data(i+14,1:178),data(i+15,1:178),data(i+16,1:178),data(i+17,1:178),data(i+18,1:178),data(i+19,1:178),data(i+20,1:178),data(i+21,1:178),data(i+22,1:178));end
I want to do something like this for the remaining sections:
s = ((i-1)/23)+1while s <= 500for i = i + 23section(s) = horzcat(data(i,1:178),data(i+1,1:178),data(i+2,1:178),data(i+3,1:178),data(i+4,1:178),data(i+5,1:178),data(i+6,1:178),data(i+7,1:178),data(i+8,1:178),data(i+9,1:178),data(i+10,1:178),data(i+11,1:178),data(i+12,1:178),data(i+13,1:178),data(i+14,1:178),data(i+15,1:178),data(i+16,1:178),data(i+17,1:178),data(i+18,1:178),data(i+19,1:178),data(i+20,1:178),data(i+21,1:178),data(i+22,1:178));endend
I'm not that familiar with indexing and am getting errors for this. If anyone could help it would be greatly appreciated!
Best Answer