Preventing repeat values in an edit text

1 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by