matlab:strcmp

TF = strcmp(string,string)

TF = strcmp(string,cellstr)

TF = strcmp(cellstr,cellstr)

注:string:   A single character string or n-by-1 array of strings;

        cellstr:  A cell array of strings.

Example:

         1、strcmp('Yes', 'No')

                              ans =
                                          0
               strcmp('Yes', 'Yes')
                               ans =
                                          1
        2、Create two cell arrays of strings and call strcmp to compare them:
          A = {'Handle Graphics', 'Statistics';   ...
               '  Toolboxes', 'MathWorks'};

          B = {'Handle Graphics', 'Signal Processing';    ...
               'Toolboxes', 'MATHWORKS'};
          match = strcmp(A, B)
          match =
               1     0
               0     0

       3、

          A = {'Handle Graphics', 'Statistics';   ...
               '  Toolboxes', 'MathWorks'};

          B = {'Handle Graphics'};
          match = strcmp(A, B)
          match =
               1     0
               0     0
posted @ 2013-08-05 22:17  BeatHeart  阅读(518)  评论(0编辑  收藏  举报