Effacer les filtres
Effacer les filtres

Preventing repeat values in an edit text

1 vue (au cours des 30 derniers jours)
jacques baptiste
jacques baptiste le 1 Mar 2018
Réponse apportée : ES le 1 Mar 2018
Hello,
I did a GUI without GUIDE. Basically the GUI is a form, so people can fill it and implement a structure without scripting experience. One of the fields filled must be unique (no duplicates, e.g: serial number/ID is unique), and i want to test if the new ID entered in the edit text is available (ID are stored in excel).
I tried to read excel file, then use "ismember" function but i had issues with ismember and I'm not even sure that is the best solution. I would like some advises about the way to proceed or an example of how people do it usually.
English isn't my first language, so if something isn't clear feel free to tell me ! :)
I put Matlab error :
Error using cell/ismember (line 34)
Input A of class char and input B of class cell must be cell arrays of strings, unless one is a string.
Thanks for reading me, best regards,
Baptiste

Réponse acceptée

ES
ES le 1 Mar 2018
>> cellExcelData = {'String1'; 'String2'; 'String3'}
cellExcelData =
'String1'
'String2'
'String3'
>> ismember('String', cellExcelData)
ans =
0
>> ismember('String1\', cellExcelData)
ans =
0
>> ismember('String1', cellExcelData)
ans =
1
>>

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by