Multiply/divided two tables
显示 更早的评论
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.
采纳的回答
更多回答(1 个)
Jon
2020-11-13
% 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 个评论
KALYAN ACHARJYA
2020-11-13
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
2020-11-13
Jon
2020-11-13
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
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
