Array multiplication in matlab
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Prajwal Kadlaplamutt Ravindra Kumar
am 9 Mär. 2019
Beantwortet: Star Strider
am 9 Mär. 2019
I have two set of text data. Lets say the size of first file is 26000*1 array and second file is 29000*1 array. I am looking to multiply the first element of 1st array with 1st element of 2nd array. How do i do that with different array sizes ? I dont mind if the extra 3000 rows of data are lost or ignored.
0 Kommentare
Antworten (1)
Star Strider
am 9 Mär. 2019
One option:
V1 = rand(26000,1); % Create Data
V2 = rand(29000,1); % Create Data
V12 = V1 .* V2(1:numel(V1)); % Element-Wise Multiplication Of First 26000 Rows
Another option (if you do not want to discard the last 3000 rows) is to interpolate the larger vector to be the length of the shorter vector, using the interp1 funciton.
0 Kommentare
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!