⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 findrow.m

📁 模糊控制工具箱,很好用的,有相应的说明文件,希望对大家有用!
💻 M
字号:
function rowNum=findrow(str,strMat)
%FINDROW Find the rows of a matrix that match the input string.
%   ROWNUM = FINDROW(STR,STRMAT) returns the index to the row or rows
%   in the matrix STRMAT that are identical to the vector STR.
%   Blanks (ASCII 32) and zeros are not considered. An empty matrix 
%   is returned if there is no match.
%
%   For example:
%
%   strMat = fstrvcat('one','fish','two','fish',[1 2 3 4 5 6]);
%   rowNum = findrow('fish',strMat)

%   Ned Gulley, 4-26-94
%   P. Gahinet 10-99
%   Copyright 1994-2002 The MathWorks, Inc. 
%   $Revision: 1.14 $  $Date: 2002/04/14 22:19:49 $

% Remove leading and trailing blanks form STR
str = fliplr(deblank(fliplr(deblank(str))));

% Initialize boolean vector that picks matching rows
nrows = size(strMat,1);
IsMatching = zeros(1,nrows);

% Process each row
for ctrow=1:nrows,
   % Remove leading and trailing blanks
   s = fliplr(deblank(fliplr(deblank(char(strMat(ctrow,:)))))); 
   IsMatching(ctrow) = strcmp(str,s);
end

rowNum = find(IsMatching);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -