Multiply/divided two tables
Mostra commenti meno recenti
How would I mulyiply two tables togther. I have one table and I took two columns from the table and I want to multiply them togther. Also how would I divide as well thanks.
Risposta accettata
Più risposte (1)
Jon
il 13 Nov 2020
% suppose you have a table T1 and T2 you could do something like
A = [T1.myColumnName1 T1.myColumnName2]
B = [T2.myColumnName3 T2.myColumnName4]
C = A.*B % assuming you want element by element multiplication
D = A./B % assuming you want element by element division
3 Commenti
KALYAN ACHARJYA
il 13 Nov 2020
Example:
data1=randi(20,[10,1]);
data2=randi(20,[10,1]);
table1=table(data1,data2)
data1=randi(10,[10,1]);
data2=randi(10,[10,1]);
table2=table(data1,data2)
% Multiple table 1,table2
data1=table1.data1.*table2.data1;
data2=table1.data2.*table2.data2;
result_mul_table=table(data1,data2)
Yogesh Bhambhwani
il 13 Nov 2020
Jon
il 13 Nov 2020
Assuming as Steven Lord suggests that you want to add the new computed column in the same table following your verbal description:
T.newColumn = myNumericalValue*T.oneColumn.*T.anotherColumn./T.yetAnotherColumn
If you just want to have that as a vector you could assign the left hand side to your vector, v
v = myNumericalValue*T.oneColumn.*T.anotherColumn./T.yetAnotherColumn
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
