MATLAB: Search the given index of a column and then replace the entire column with a single value.

coulumn manipulationgiven index of a column and then replace the entire column with a single value.matrixmatrix manipulationsearch the given index of a column and then replace the entire column with a single value

I have a matrix QI=1×50 which are the index of Data=100×299. Now I need to replace the entire column of a particular index with the index value Mid=1×299.
Say QI=[14 3 24 100] which are indexes of Data=[0.242 0.0002 0.25 1.002 ] so on upto 100X299 Now replace the column with mid=[0.02 00.3 0.256 0.514] upto 1×299
Thanks in Advance

Best Answer

Not sure if this is what you want.
[~,col]=ind2sub(size(Data),QI);
Data(:,col)=repmat(Mid,1,length(col));