Multiply/divided two tables
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (1)
Jon
el 13 de Nov. de 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 comentarios
KALYAN ACHARJYA
el 13 de Nov. de 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
el 13 de Nov. de 2020
Jon
el 13 de Nov. de 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
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
