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!
