Hi guys, I would appreciate your help on this problem. I have a row vector (M) of size 1×2108 which contains data for 62 countries and 34 industries for each country. So, column 1:34 is industry data for country 1, 35:68 country #2 etc. I just need to make a matrix which will be of a size 62×2108 and have data in following way: – row #1, columns 1:34 for country #1, elsewhere zeros – row #2, columns 35:68 for country #2, elsewhere zeros – row #3, columns 39:102 for country #3, elsewhere zeros etc.
So far, I used this code:
M_new=zeros(62,2108);for i=1:62 for j=1:62 M_new(i,((j-1)*34+1):(j*34))=M(1,((j-1)*34+1):(j*34)); endend
but I only get row vector copied 62 times in each row.
Best,
Miroslav
Best Answer