Multiplying elements from various tables to create a third table
Mostra commenti meno recenti
Hi there,
I'm a beginner to Matlab, and I have a very shaky foundation. However, I need the help of Matlab to do some analysis. I would highly appreciate your help!
I have two types of data sets I'm drawing from
(for n =1:82 tables) Table A_n(70080 x 4)
Table B(82 x 1)
Basically, I need to individually multiple the 'nth' element in Table B by the second column of Table A_n.
This should result in Table C (70080 x 82).
I know I can produce the variables for each column vector of Table C by inputting this:
Col_1 = A_1(:,2)*B(1,1);
Col_2 = A_2(:,2)*B(2,1);
...
Col_n = A_n(:,2)*B(n,1);
but it is manually taxing. Furthermore, I have no idea how to input these into an actual table. This would require some sort of concantenation?
Initially I wanted to dynamically create these variables but I have read elsewhere that doing so is actually quite troublesome.
Is there any way for me to input these variables directly into a table?
And to do this all through a for loop...
Thanks!
1 Commento
Christina Hong
il 28 Lug 2020
Risposta accettata
Più risposte (1)
Mario Malic
il 28 Lug 2020
Check if it gives correct output.
C = (A(:,2)'.*B)';
4 Commenti
Christina Hong
il 28 Lug 2020
Mario Malic
il 28 Lug 2020
Modificato: Mario Malic
il 28 Lug 2020
Christina Hong
il 29 Lug 2020
Mario Malic
il 29 Lug 2020
Modificato: Mario Malic
il 29 Lug 2020
The line that I wrote gives you the Variable C with (70080 x 82).
Categorie
Scopri di più su Tables in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!