Multiplication with in a double arrray

1 回表示 (過去 30 日間)
Jonathan Drane
Jonathan Drane 2020 年 4 月 7 日
コメント済み: Jonathan Drane 2020 年 4 月 8 日
Hi, this is my first question so go easy on me please I am a new Matlab user.
I have searched arround the help section and cannot seem to find the answer I am after.
I have some numerical data in a 4096x2 double array and I would like to multiply each cell by another cell in the array to make a new cell and turn the array into a 4096x3 array.
Eg.
A1=1 B1=1 C1=A1*B1
A2=2 B2=2 C2=A2*B2
A3=3 B3=3 C2=A3*B3
Thanks in advance for the help
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 4 月 7 日
A=[1 2 3 4];
B=[5 6 7 8];
C=A.*B

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

採用された回答

James Tursa
James Tursa 2020 年 4 月 7 日
編集済み: James Tursa 2020 年 4 月 8 日
M = your 4096x2 double matrix
M(:,3) = M(:,1) .* M(:,2);
  1 件のコメント
Jonathan Drane
Jonathan Drane 2020 年 4 月 8 日
James, Thanks so much for this answer it works exaclty as required.

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

その他の回答 (1 件)

madhan ravi
madhan ravi 2020 年 4 月 7 日
Wanted = [A,B,A.*B]

カテゴリ

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

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by