By using for loop command take values from several matrices to build a new matrix in matlab

<>

This question already has an answer here:

Answers


You don't need for loop for this. What you want to achieve is to interleave two matrices, you can do it manually

C = [A(:, [1 2]), B(:, [1 2]), A(:, [3 4]), B(:, [3 4])];

Or you can make it into a more general solution:

function out = interleave(m1, m2, step)
out = [reshape(m1, [numel(m1)/step step]); reshape(m2, [numel(m2)/step step])];
out = reshape( out, [size(m1,1) numel(out)/size(m1,1)]);
end

Then

C = interleave(A,B,2)

will give you the result you want.


Need Your Help

Dropdown container not showing right padding

html css twitter-bootstrap

I'm kinda new to HTML/CSS, and I'm trying to create a page with a login dropdown, but for some reason there's no padding on the right side of it. How can I fix it?

Git operations occasionally hang in Jenkins on Windows

windows git jenkins assembla gitblit

We are running continuous Jenkins builds of a Git project hosted at Assembla.