Array multiplication in matlab
조회 수: 6 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Star Strider
2019년 3월 9일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!