I'm getting "Index in position 1 is invalid. Array indices must be positive integers or logical values." in my code
Mostrar comentarios más antiguos
Hi everyone, I'm developing a code that needs to use a linear mixed effects regression. When a I try to use a table in this tool im getting an error message "Index in position 1 is invalid. Array indices must be positive integers or logical values." Can you help me to solve it?
data_resi_inter = readtable('Residuales_inter.xlsx');
data_resi_intra = readtable('Residuales_intra.xlsx');
%% Regresion y obtencion de Residuales Inter evento (Interplaca)
lme_inter = fitlme(data_resi_inter,'res_PGA ~ 1 + (1|EQID)');
[beta_inter,betanames_inter,Fstats_inter] = fixedEffects(lme_inter);
c0_inter = beta_inter;
SE(i,1) = Fstats_inter.SE;
[B_inter,Bnames_inter,Rstats_inter] = randomEffects(lme_inter);
eta_inter = B_inter;
error_B_inter = (Rstats_inter.Upper-Rstats_inter.Lower)/2;
[psi_inter,mse_inter,stats_inter] = covarianceParameters(lme_inter)
1 comentario
Respuesta aceptada
Más respuestas (1)
Hi Ivan,
Upon investigation of the error through the provided script and the excel files, I see that you are trying to index into SE with paramters as i and 1.
Please know that since first parameter i is not defined in the script before that line (assuming the provided script is the only code), the first parameter is considered to be a complex no. i.e.
0.0000 + 1.0000i
Please ensure that you use the correct positive (>0) index parameter to save the Fstats_inter.SE data. e.g.
SE(1,1) = Fstats_inter.SE
I hope it resolved your query.
1 comentario
Ivan
el 4 de Sept. de 2024
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!