MATLAB: How to add columun values to another 3th columun in a matrix without touching the other columns

#matrix#column #add #values

hello ,
i have a matrix of size (8*3) and i have a column with differents values , what i want is adding this column to the values of my 3th column values . and this work i have to do it for 118 time this is how it looks my programe
for i=1:118
a= bsxfun(@times, avgPower(:,3), (m(i)/105).^2);% a is my column with new vales to add
avg=avgPower+a;% here i want to add my values column a to the vaues of my 3th column in the matrix(8*3) without touching the 1st and 2d column
end
this one is avg=avgPower+a; is wrong but i dont know to to program it.
thank you a lot

Best Answer

It would be helpful to have more details of your code and what you want to do.
Try this:
avg = avgPower(:,3)+a;
You do the addressing correctly in the bsxfun call, so your reason for not doing it when creating the ‘avg’ array is not obvious.