Created
October 10, 2022 01:30
-
-
Save manucabral/4d1a3115046c56704f515ddbb496d3a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% import required modules for parse csv file | |
pkg load io | |
# load csv files | |
boxes_data = csv2cell("boxes.csv"); | |
units_data = csv2cell("units.csv"); | |
# target column for multiply | |
target_column = 3; | |
# delete headers | |
boxes_data(1,:) = []; | |
units_data(1,:) = []; | |
# checks arrays size | |
if (!size_equal(boxes_data, units_data)) | |
error("can't multiply, diff sizes") | |
endif | |
# output array | |
multiply_data = [] | |
# get number of rows | |
[nr] = size(boxes_data); | |
# iterate each row | |
for i = 1:nr-1 | |
multiply_data(i,1) = boxes_data{i,target_column} .* units_data{i,target_column} | |
endfor | |
csvwrite ("multiplied.csv", multiply_data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment