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

9 vues (au cours des 30 derniers jours)
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 commentaire
Image Analyst
Image Analyst le 22 Nov 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:

Connectez-vous pour commenter.

Réponse acceptée

Jeff Miller
Jeff Miller le 22 Nov 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];

Plus de réponses (0)

Catégories

En savoir plus sur Analysis of Variance and Covariance dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by