Comparing two srings using strcmpi
2 次查看(过去 30 天)
显示 更早的评论
I have stored the data of a uitable into a file dbt9.mat.. The first and second columns conntains the name and IdNo of an individual respectively. When I enter the name the corresponding IDno must be displayed in a editbox..
if true
% code
end
In=load('C:\Users\Animesh\Documents\MATLAB\dbt9.mat');%file name
ln=size(In.comp,1);% comp is the data in uitable dbt9..
for i=1:ln
nam=In.comp{i}
b=strcmpi(nam,name); name is the name I have entered
if b==1
break;
end
end
if b==0
set(handles.edit3,'String','NOT in db');
else
set(handles.edit3,'String',In.comp{ln+i});
end
The problem is that when my gui is opened at first it works perfectly fine but when I try with another name (keeping the gui open) it shows 'NOT in db'..and when i close the gui and open it once again and try with the same name the corresponding Idno is displayed.The problem arises in strcmpi .. Any reason why it is happening like this?? Can anyone help please? Thanks a lot in advance..
0 个评论
采纳的回答
Image Analyst
2013-12-26
Before the strcmpi put these lines:
name
nam
whos name
whos nam
What does it report in the command window? You might also find this useful: http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/
8 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!