Hello, I have a matrix of order 1664 X 128. How can I insert a column of zeros after every column. So that, every second column in the matrix is a zero column. So that new matrix will have order 1664 X 256?. Kindly help me out.

1 次查看(过去 30 天)
If A is of order 1664 X 128. I need to insert zeros after every column, i.e. every 2nd column is a zero column. So that new matrix will have order 1664 X 256. Kindly help me in this issue.
Thanks, Sai..

采纳的回答

Rik
Rik 2018-10-3
编辑:Rik 2018-10-3
This should work.
data=rand(1664,128);%generate data for example
new_data=zeros(size(data,1),2*size(data,2));
new_data(:,1:2:end)=data;

更多回答(1 个)

Sai Prakash Reddy Konda
Thank you so much.

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by