【问题标题】:How to do strcmp in textboxes with Matlab如何使用 Matlab 在文本框中执行 strcmp
【发布时间】:2017-03-04 13:25:24
【问题描述】:

我想知道如何在 Matlab 中比较两个文本框之间的字符串。有人可以举一些例子吗?

【问题讨论】:

    标签: matlab strcmp


    【解决方案1】:
    str1=get(handles.edit1,'String');
    str2=get(handles.edit2,'String');
    
    if (  strcmp(str1,str2)==1)        
     set(handles.edit3,'String','equal');
    else
     set(handles.edit3,'String','not equal');
    end
    

    str1 和 str2 是字符串变量。从文本框表单获取函数检索字符串并使用 set 函数将字符串放入文本框。并将两个字符串变量与 strcmp 函数进行比较。比较等于返回1,否则返回0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-29
      相关资源
      最近更新 更多