Clear Filters
Clear Filters

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 view (last 30 days)
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..

Accepted Answer

Rik
Rik on 3 Oct 2018
Edited: Rik on 3 Oct 2018
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;

More Answers (1)

Sai Prakash Reddy Konda
Sai Prakash Reddy Konda on 3 Oct 2018
Thank you so much.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!