MATLAB Answers

Multiplication with in a double arrray

5 views (last 30 days)
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 Comment

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 7 Apr 2020
Edited: James Tursa on 8 Apr 2020
M = your 4096x2 double matrix
M(:,3) = M(:,1) .* M(:,2);

  1 Comment

Jonathan Drane
Jonathan Drane on 8 Apr 2020
James, Thanks so much for this answer it works exaclty as required.

Sign in to comment.

More Answers (1)

madhan ravi
madhan ravi on 7 Apr 2020
Wanted = [A,B,A.*B]

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products


Release

R2016b

Translated by