reshaping

6 次查看(过去 30 天)
mahaveer hanuman
mahaveer hanuman 2011-6-23
i have A= 1 0 1 0 0 0 1 and B= 1 1 1 0 0 0 1 now i need to make it as s= 1 1 0 1 1 1 0 0 0 0 0 0 1 1 can any please help me

采纳的回答

Matt Fig
Matt Fig 2011-6-23
A = [1 0 1 0 0 0 1];
B = [1 1 1 0 0 0 1];
s = reshape([A;B],1,[])

更多回答(1 个)

Sean de Wolski
Sean de Wolski 2011-6-23
s= zeros(1,numel(A)+numel(B))
s(2:2:end) = B;
s(1:2:end) = A;
?
  5 个评论
Walter Roberson
Walter Roberson 2011-6-23
But the solution you gave below is the same effectively solution as Sean already gave, which Mahaveer was replying to. I took Mahaveer's "now i need" as indicating Mahaveer needed something _different_ now.
Matt Fig
Matt Fig 2011-6-23
Oh, I took it as that he didn't understand Sean de's solution because he had it in his mind that there was going to be some 'reshaping' done...

请先登录,再进行评论。

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by