It looks like there is a constant offset of 48 between what the value of k is and what it should be, so for now, I am using the following:
function update_browse_btn(src,data,k,gui)
% Called when user activates popup menu
val = get(src,'Value');
if val == 2
set(gui.browse_btns{k-48},'Enable','on');
set(gui.ip_file_edit{k-48},'Enable','on');
else
set(gui.browse_btns{k-48},'Enable','off');
set(gui.ip_file_edit{k-48},'Enable','off');
end
end
This works well for all the scenarios and all possible values of k, but I am slightly uneasy at having an unexplained, hard-coded, offset in the code, even if this is only a prototype (the final version will probably be coded in C# for deployment to end-users). Anyway, it does the job for now until I find a more elegant and more robust solution.
Thanks,
Arnaud