Can't delete custom montage


I have created montages with a script, and now want to delete them. For an unknown reason, I cannot manage to delete some of them. Whether I use the "Delete" key or the UI button "Delete montage", I get the following error:

*Error using cellismemberlegacy (line 24)*
*Unrecognized flag 'ICs_S20_ind_inv1'. Valid flags are 'rows', 'legacy'.*

*Error in cell/ismember (line 98)*
*        lia = cellismemberlegacy(a,b,flag1,flag2);

*Error in panel_montage>DeleteMontage (line 1156)*
*    if ismember(sMontage.Name, {'Bad channels', 'Average reference', 'Average reference (L -> R)', 'Scalp current density', 'Scalp current density (L -> R)', 'Head distance'})

*Error in panel_montage>ButtonDelete_Callback (line 321)*
*        DeleteMontage(sMontages(i).Name);

*Error in panel_montage>MontageKeyTyped_Callback (line 255)*
*            ButtonDelete_Callback(hFig);

*Error in panel_montage>@(h,ev)MontageKeyTyped_Callback(ev,hFig) (line 554)*
*                                   'KeyTypedCallback',     @(h,ev)MontageKeyTyped_Callback(ev,hFig), ...

Would you have any idea about the cause of this issue?

Thank you,


My guess is that either the montage doesn't exist, or you created multiple montages with the same (which would cause all sorts of issues, as their names as supposed to be unique).

I added some code to handle better the abnormal case you posted here, but you still need to fix your list of montages...

1 Like

Hello Francois,

Thank you for your answer.
Indeed, I accidentally created several montages with the same name.
To remove them I used the script of the function DeleteMontage(MontageName) in panel_montage.m, bypassing the first lines using ismember() that were returning the error.

Thank you,