Hey everyone, how can I write code that changes the Matrix
B=[1 1; 0 0]
into the first line of Matrix A? Just using B, Matrix A should be [1 0 1 0] (columns first). However, if we had Matrix B, as well as Matrix C being [1 1 ; 0 1], the second line of Matrix A should be from Matrix C.
So, Matrix A would be [1 0 1 0; 1 0 1 1]. How is this done!!

 採用された回答

dpb
dpb 2016 年 10 月 16 日

0 投票

>> B=[1 1; 0 0];
>> C=[1 1; 0 1];
>> A=[B(:) C(:)].'
A =
1 0 1 0
1 0 1 1
>>

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by