MATLAB: How to fix this error -> Undefined function ‘eq’ for input arguments of type ‘cell’.

countnumber of elements

%%%%Calculate the number of times each element from netlist appears. %%%%
num_tot =(size(element));
num_tot = num_tot(1);
num_ind = sum(element(:) =='L');
num_res = sum(element(:) == 'R');
num_cap = sum(element(:) == 'C');
num_exc = sum(element(:) == 'E');

Best Answer

Guessing here that ‘element’ is a cell array of some sort.
Try this:
element = {'L' 'R' 'C' 'E' 'L' 'R' 'C' 'E'}; % Create What I believe ‘element’ Is
num_ind = sum(strcmp(element, 'L'));