Multiplying an entire table by a column from another table.
조회 수: 6 (최근 30일)
이전 댓글 표시
I want to take my a table of "data" and multiply it by a specific column from another table to result in "processed data". I have tried different multipication functions but I am always given the error "Undefined operator '.*' for input arguments of type 'table'." Is there a specific function that I am unaware of? I am running Matlab R2019a. Thank you.
댓글 수: 0
채택된 답변
Star Strider
2020년 3월 10일
Example —
T = array2table(randi(99, 7, 5));
V = randi(99, 7, 1);
TV = varfun(@(x)x.*V, T);
댓글 수: 2
추가 답변 (1개)
Bhaskar R
2020년 3월 10일
t1 = table;
t2 = table;
% table t1
t1.a = rand(10,1);
t1.b = rand(10,1);
% table t2
t2.c = rand(10, 1);
%processed_data
processed_data = t1.a.*t2.c;
% or if you want to embed in table
t1.processed_data = t1.a.*t2.c;
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!