Borrar filtros
Borrar filtros

Index exceeds the number of array elements. Index must not exceed 3.

356 visualizaciones (últimos 30 días)
Akin Akinboboye
Akin Akinboboye el 24 de Nov. de 2021
Respondida: tzofia el 31 de Dic. de 2023
for i=(k+1):5
quotient=floor(((rem*97)+Code(i))/16);
%quotient
rem=mod(((rem*97)+Code(i)),16);
Code(i)=quotient;
end
Index exceeds the number of array elements. Index must not exceed 3.
Error in Transmission_with_file (line 296)
quotient=floor(((rem*97)+Code(i))/16);

Respuestas (3)

KSSV
KSSV el 24 de Nov. de 2021
This error occurs when you try to extract more number of elements then present in the array.
A = rand(1,4) ; % 1x4 array
A(1) % no error
ans = 0.5853
A(end) % no error, it will extract last element
ans = 0.4302
A(5) % error, as there is no 5th element.
Index exceeds the number of array elements. Index must not exceed 4.
In the same way, when you are indexing check the limits of indices. The indices should not exceed the dimensions of the array.

Enguerrand Galmiche
Enguerrand Galmiche el 13 de Feb. de 2023
Editada: Enguerrand Galmiche el 13 de Feb. de 2023
Hello,
This code return the error message "Index exceeds the number of array elements. Index must not exceed 6.". The idea is read the values of table Excel and concatenate the values for every iterate of loop. What can I for correct this error and this problem.
Thanks
experience='Analyse_Pose_Docking';
extension='xlsx';
%Récupération de la liste des fichiers de données preésents dans le dossier
%d'expérience
filelist=dir(fullfile('C:\Users\Stagiaire\Desktop\Enguerrand\Analyse_Pose_Docking', ['*.',extension]));
nfiles=length(filelist);
disp(filelist)
%Initialisation des vecteurs
RMSD=[];
Glide_Score=[];
Analyse_Vec=[];
RMSD_Random=zeros(1500,1);
Glide_Score_Random=zeros(1500,1);
%Pour chaque fichier, on récupère des valeurs particulières de données que
%l'on souhaite traiter
for ifile=1:nfiles
disp(['Traitement du fichier n° ',sprintf('%d',ifile)])
filename = fullfile('C:\Users\Stagiaire\Desktop\Enguerrand\Analyse_Pose_Docking',filelist(ifile).name); % Récupération du nom de fichier complet
disp(filename)
% Importation des données de RMSD et De Score de chaque fichier excel
% du répertoire de données
RMSD = xlsread(filename,'B:B');
Glide_Score = xlsread(filename,'C:C');
RMSD_Random = [RMSD(ifile); RMSD];
Glide_Score_Random = [Glide_Score(ifile); Glide_Score];
Analyse_Vec = horzcat(RMSD_Random, Glide_Score_Random); %Concatène les 2 vecteurs dans une matrice
disp(RMSD)
disp(Glide_Score)
disp(Glide_Score_Random)
disp(RMSD_Random)
end
%Initialisations
Double_RMSD = zeros(nfiles,1);
Int_RMSD = zeros(nfiles,1);
Count_RMSD = zeros(nfiles,1);
Double_RMSD = 2*RMSD;
Int_RMSD = fix(Double_RMSD);
for i=1:nfiles
Count_RMSD = unique(Int_RMSD);
end
%Calcul de la fréquence de chaque valeur de RMSD
X_max = max(Int_RMSD); %Cherche la valeur de RMSD la plus grande dans la matrice Eff_RMSD
Eff_RMSD = hist(Int_RMSD,X_max); %build input vector
Freq_RMSD = Eff_RMSD/length(Int_RMSD); % histogramme normalisé
Freq_RMSD_Percent = 100*Freq_RMSD;
Cumul_RMSD = cumsum(Freq_RMSD_Percent);
figure
bar(Cumul_RMSD);
figure
axis on
plot(Cumul_RMSD,'Color','r','LineStyle','-','Marker','^','MarkerFaceColor','r','MarkerSize',5)
title('Evolution du pourcentage de poses de docking en fonction du RMSD')
xlabel('$2 \times RMSD (\AA)$', 'Interpreter', 'LaTeX')
ylabel('% Poses trouvées')

tzofia
tzofia el 31 de Dic. de 2023
יש לי שגיאה כזאת בקוד MATLAB הנה השגיאה :Index exceeds the number of array elements. Index must not exceed 3.
Error in New_Training_model (line 24)
imshow(imds.Files{perm(i)});

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by