Hey Matlab Fam,
I'm trying to update an inventory file and read in an excel file but the xlsread function shows all strings as NaN values (unfortunately some item codes are strings). I need to be able to compare values from 2 columns in different excel files and they have strings. When I use the [num,txt,raw] method, the if statement with the == operator doesn't work and shows:
Undefined operator '==' for input arguments of type 'cell'.
If I change from parentheses to curvy brackets, {}, the == operator works but then the message shows:
Matrix dimensions must agree.
For the code below, I imported the inventory_file and file1 and created 2 arrays: inventory_file_sku and file1_sku. I need to import file1's quantities into an array with the corresponding row number as the items in inventory_file_sku. file1 has more products than inventory_file so I need to pick the right ones from file1.
new_qty = [];
for i = 1:989
for j = 1:7083
if file1_sku{j,1} == inventory_file_sku{i,1}
new_qty(i) = file1_qty{j};
end
end
end
Can someone help? Thank you in advance!