multiply table and matrix
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mo Das
am 23 Mai 2019
Kommentiert: Mo Das
am 23 Mai 2019
how can i multiply these example?
A= {[0.2 0.5 0.3] [ 0.1 0.1 0.3]}
A=cell2table(A)
B=[ 2 3]
A*B must be {[0.4 1 0.6] [0.3 0.3 0.9]}
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 23 Mai 2019
Bearbeitet: madhan ravi
am 23 Mai 2019
I prefer Adam's method :
although if you want to multiply table with matrix then=>
arrayfun(@(x) A{:,x}*B(x),1:numel(B),'un',0)
0 Kommentare
Weitere Antworten (1)
Adam
am 23 Mai 2019
Why all the complications with cell arrays and tables? Just use numeric arrays:
A = [0.2 0.5 0.3; 0.1 0.1 0.3];
B = [2;3];
C = A.* B;
or
C = bsxfun( @times, A, B );
if you have an older version of Matlab.
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!