Effacer les filtres
Effacer les filtres

how to get a code to ignore variables under certain conditions

4 vues (au cours des 30 derniers jours)
avram alter
avram alter le 27 Oct 2020
Commenté : Sudhakar Shinde le 28 Oct 2020
Sorry if the title is a bit vague. basically, I have a code that takes a scanned RFID tag, and compares it to a tag stored on an excel file. each cell in the excel file contains a single hexadecimal code, and stands in for a panel in a GUI. if the codes match, the panel turns green, if they don't, the panel turns red. there are 8 panels in the GUI, if all the panels match, then a button will be enabled on the GUI. here is the code:
for i=1:inf
pause(0.01)
% for n = 1:2
for portidx = 1 : nport
nbase = portidx * 2 - 1;
for n = nbase:nbase+1
if i>10 % positive reading
readData = fscanf(tags{portidx});
if length(readData)>12
BOX(str2double(readData(8)),1:12)= readData(11:22);
if strcmp(TrueValMat{2,n}, BOX(n,:)) %cannot sub-index to CELL types normally, must use this method
set(handles.Box(n), 'BackgroundColor', 'g');
else
set(handles.Box(n), 'BackgroundColor', 'r');
end
drawnow % allows GUI to update the appearance whenever the loop completes.
if strcmp(TrueValMat{2,1}, BOX(1,:))...
&& strcmp(TrueValMat{2,2}, BOX(2,:))...
&& strcmp(TrueValMat{2,3}, BOX(3,:))...
&& strcmp(TrueValMat{2,4}, BOX(4,:))...
&& strcmp(TrueValMat{2,5}, BOX(5,:))...
&& strcmp(TrueValMat{2,6}, BOX(6,:))...
&& strcmp(TrueValMat{2,7}, BOX(7,:))...
&& strcmp(TrueValMat{2,8}, BOX(8,:))
set(handles.certifyButton, 'enable', 'on');
end
end
end
end
end
end
I know it is a bit ugly, but it gets the job done.
My question is this: is there a way for me to allow a user to double click on one of the panels in the GUI, and it will then disable that panel, and make the rest of the code ignore that panel, and pretend that a correct code was scanned? I used GUIDE to make the program, and would prefer to continue working in GUIDE.
  1 commentaire
Sudhakar Shinde
Sudhakar Shinde le 28 Oct 2020
One option could be:
Create dropdown on GUI created from guide such that your panel names will be able to select from dropdown menu. Select the panel name from dropdown and use these values to enable or disable perticular panel.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by