Preventing repeat values in an edit text

1 view (last 30 days)
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

Accepted Answer

ES
ES on 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
>>

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!