parsecontent.m

来自「This code can parse any image in matlab.」· M 代码 · 共 32 行

M
32
字号
function query = parseContent(content, character);
% Utility function.
%
% Parses the query string and produce a cell array of cell arrays.
% This function is called from several functions in the toolbox.
%
% It is case sensitive.
%

if nargin == 1
    character = ',';
end

ndx = [0 findstr(content, character) length(content)+1];
for n=1:length(ndx)-1
    element = content(ndx(n)+1:ndx(n+1)-1);
    if element(1)~='+' & element(1)~='-'
        element = ['+' element];
    end

    clear term;
    ndxQ = sort([findstr(element, '+') findstr(element, '-') length(element)+1]);
    for m=1:length(ndxQ)-1
        if element(ndxQ(m))
            %term{m} = lower(element(ndxQ(m):ndxQ(m+1)-1));
            term{m} = element(ndxQ(m):ndxQ(m+1)-1);
        end
        query{n} = term;
    end
end

⌨️ 快捷键说明

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