fit data into repeated measure table

1 次查看(过去 30 天)
Hi All, Do u know how to fit the data into repeated measure table for analysis? I tried the example from mathworks but it do not work in my data.
% load weight
%whos LTST CHSD PND28W1 PND34W2 PND40W3 PND46W4 PND52W5 PND58W6 PND64W7 PND70W8 PND76W9 PND82W10 PND88W11 PND94W12 PND100W13 PND106W14 PND112W15 PND118W16 PND124W17 PND130W18
%CHSD=CHSD(1:77,:) ;
%meas=[ PND28W1 PND34W2 PND40W3 PND46W4 PND52W5 PND58W6 PND64W7 PND70W8 PND76W9 PND82W10 PND88W11 PND94W12 PND100W13 PND106W14 PND112W15 PND118W16 PND124W17 PND130W18];
%meas=meas(1:77,:);
%meas=filloutliers(meas,'nearest','mean'); %meas=fillmissing(meas,'previous');
%t = table(CHSD,meas(:,1),meas(:,2),meas(:,3),meas(:,4),meas(:,5),meas(:,6),meas(:,7),meas(:,8),meas(:,9),meas(:,10),meas(:,11),meas(:,12),meas(:,13),meas(:,14),meas(:,15),meas(:,16),meas(:,16),meas(:,17),meas(:,18),'VariableNames',{'CHSD','meas1','meas2','meas3','meas4','meas5','meas6','meas7','meas8','meas9','meas10','meas11','meas12','meas13','meas14','meas15','meas16','meas17','meas18'});
%Meas = table([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ]','VariableNames',{'Measurements'});
%rm = fitrm(t,'meas1-meas18~CHSD','WithinDesign',Meas);
%ranovatbl = ranova(rm) ;

回答(1 个)

AN NING
AN NING 2018-3-2
Here is the error:
Error using matlab.internal.tabular.private.tabularDimension/assignLabels (line 365) The VariableNames property must contain one name for each variable in the table.
Error in matlab.internal.tabular.private.varNamesDim/validateAndAssignLabels (line 404) obj = obj.assignLabels(newLabels,fullAssignment,varIndices);
Error in matlab.internal.tabular.private.tabularDimension/setLabels (line 173) obj = obj.validateAndAssignLabels(newLabels,indices,fullAssignment,fixDups,fixEmpties,fixIllegal);
Error in matlab.internal.tabular.private.tabularDimension/createLike_impl (line 355) obj = obj.setLabels(dimLabels,[]);
Error in matlab.internal.tabular.private.varNamesDim/createLike (line 76) obj = obj.createLike_impl(dimLength,dimLabels);
Error in tabular/initInternals (line 212) t.varDim = t.varDim.createLike(nvars,varnames); % error if invalid, duplicate, or empty
Error in table (line 259) t = t.initInternals(vars, numRows, rownames, numVars, varnames);
Error in Analysis_of_weightgainpercentage (line 18) t = table(CHSD,meas(:,1),meas(:,2),meas(:,3),meas(:,4),meas(:,5),meas(:,6),meas(:,7),meas(:,8),meas(:,9),meas(:,10),meas(:,11),meas(:,12),meas(:,13),meas(:,14),meas(:,15),meas(:,16),meas(:,16),meas(:,17),meas(:,18),'VariableNames',{'CHSD','meas1','meas2','meas3','meas4','meas5','meas6','meas7','meas8','meas9','meas10','meas11','meas12','meas13','meas14','meas15','meas16','meas17','meas18'}); Trial>>

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by