Matrix index is out of range for deletion
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi
Im using EEGLAB toolbox for preprocess my data.
one step in my preprocessing is to remove manually some noisy segments of the data.
When Im using the removing function i have no problem at all, but when Im using my code on a multiple subjects i get the error below:
the part of the code which stack when applied on multiple subjects:
any suggestions?
0 Commenti
Risposte (1)
Walter Roberson
il 28 Ott 2020
You have a loop in which you move forward through the loop, deleting entries if some condition matches.
However, every time you delete something, everything after that in the same array "falls down" to fill the hole, sort of like in Tetris. And so all of the positions you had calculated for anything after that become invalid, because the corresponding data entries have moved forward in the array by size corresponding to what you deleted.
The easiest way to fix this kind of problem is not to loop forward deleting as you go, but instead to move backwards deleting as you go. The positions for anything before for deletion point will not be changed by having deleted afterwards, so you do not need to update anything in the positions.
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!