Adding additional column into the array

80 ビュー (過去 30 日間)
Turbulence Analysis
Turbulence Analysis 2022 年 4 月 8 日
Hi,
I have two arrays A, B of size 100 x 3 and 100 x 5 . Here I would like to copy the entries in the fifth column of B array to fourth coulmn in A. So finnaly A becomes 100 x 4.
Any idea how to do this..??

採用された回答

Benjamin Thompson
Benjamin Thompson 2022 年 4 月 8 日
Reducing row size from 100 to 5 for clarify of answering here.
>> A = zeros(5,3)
A =
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
>> B = ones(5,5)
B =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
>> A(:,4) = B(:,5)
A =
0 0 0 1
0 0 0 1
0 0 0 1
0 0 0 1
0 0 0 1
>>

その他の回答 (1 件)

Mathieu NOE
Mathieu NOE 2022 年 4 月 8 日
hello
simply this
Anew = [A B(:,5)];
  1 件のコメント
Turbulence Analysis
Turbulence Analysis 2022 年 4 月 8 日
Thanks a lot

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by