I am having trouble with errors in the array used for anova analysis

9 visualizaciones (últimos 30 días)
Sorry for the messy code, but I've programmed a 10x3x3 anova analysis and I'm getting an error code and I don't know what's causing it.
Error Code : The grouping variable must be a categorical vector, numeric vector, logical vector, datetime vector, duration vector, character array, string array, or cell vector of character vectors.
The grouping variable must be a categorical vector, numeric vector, logical vector, datetime vector, duration vector, character array, string array, or character vector cell vector.
Does anyone know the cause?
dataFileName1 = 'AllParmeter_Exp1';
dataFileID1 = fopen([dataFileName1,'.txt'],'r');
if (dataFileID1 == -1);
error('data file not exist');
end
formatSpec = '%f';
y = fscanf(dataFileID1,formatSpec)
fclose(dataFileID1);
g1 = {1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10};
g2 = {'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW'};
g3 = {'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'CA';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'JP';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW';'TW'};
p = anovan(y,{g1,g2,g3})
  1 comentario
Image Analyst
Image Analyst el 22 de Nov. de 2022
You forgot to attach ''AllParmeter_Exp1.txt';
If you have any more questions, then attach your data with the paperclip icon after you read this:

Iniciar sesión para comentar.

Respuesta aceptada

Jeff Miller
Jeff Miller el 22 de Nov. de 2022
Looks like g1 should be a numerical vector, not a cell array (i.e., square brackets instead of curly brackets). e.g.,
g1 = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10 et cetera];

Más respuestas (0)

Categorías

Más información sobre Analysis of Variance and Covariance en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by