Borrar filtros
Borrar filtros

Comparing two srings using strcmpi

4 visualizaciones (últimos 30 días)
Animesh
Animesh el 26 de Dic. de 2013
Comentada: Image Analyst el 26 de Dic. de 2013
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..

Respuesta aceptada

Image Analyst
Image Analyst el 26 de Dic. de 2013
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 comentarios
Animesh
Animesh el 26 de Dic. de 2013
It worked..Thanks a lot for helping.
Image Analyst
Image Analyst el 26 de Dic. de 2013
Please mark my answer as Accepted then. Thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by