I am trying to write a function which converts all answers to a Likart survey to 1 and 0. The code itself works, but when I trz to run the function itself i get an error stating "Dot indexing is not supported for variables of this type.
Error in funclikart2 (line 5)
header = T.Properties.VariableNames; % keep table variable names"
This is my code:
function T = funclikart2(tabName, sheetnumber)
T = xlsread(tabName, sheetnumber);
header = T.Properties.VariableNames;
yesIdx = ismember(lower(T), {'agree', 'strongly agree'});
T(yesIdx) = 1; T(~yesIdx) = 0;
T = array2table(T, 'VariableNames', header);
end
Can anyone help me out?