Index exceeds the number of array elements (1). How can I correct this error?
Ältere Kommentare anzeigen
Hi I've got this code that gives me the messages from a variable that are from a mmsi that I want
Msg_mmsi_selected = [];
for i=1:1:L
seq1 = msg_NoMatchAIS1(i);
linia=convertStringsToChars(seq1);
if linia(13)=='A' && linia(15)=='1'
sequencia = ais_to_bit(linia(15:44));
s_mmsi=sequencia(9:38);
mmsi= bin2dec(num2str(s_mmsi));
Msg_mmsi_selected = seq1(mmsi_selected); % Here is the line that give me error
end
end
and the error I got is
Index exceeds the number of array elements (1).
Is there any problem in the line code that makes me this error. I thought it was because of not named the variable but I did and do not know why I continue having it.
3 Kommentare
flashpode
am 26 Okt. 2021
DGM
am 26 Okt. 2021
There's not enough information to answer the question. The index mmsi_selected exceeds the number of elements in seq1, but nobody knows what either of these two variables are (their value or size) or how they are created.
Try to provide enough context such that the problem can be reproduced.
flashpode
am 26 Okt. 2021
Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!