ft_find_element_in_block.m

来自「用matlab做的Frequency domain INterferomEter」· M 代码 · 共 52 行

M
52
字号
%---------------------------------------------------------------------  % function [lines] = FT_find_element_in_block(block, position, value)% % Returnes line numbers for which the element specified by position and value% has been found.%% block: single block structure% position: integer, specifying the element's position% value: double or string which is the element's content% lines: vector of integers containing line numbers where elements where found%% Part of the SimTools package% Andreas Freise 22.05.08 afreise@googlemail.com%---------------------------------------------------------------------  function [lines] = FT_find_element_in_block(block, position, value)  % base string for error message id  baseid='FT_find_element_in_block';  if (~isstruct(block))    msgid=[baseid,':checkinarg'];    result='first input argument must be a block structure';    error(msgid,result);  end  pos=int8(position);  if(pos~=position)    msgid=[baseid,':checkinarg'];    msg='second input argument must be of type integer';    error(msgid,msg);      end  if (iscell(value))    value=cell2mat(value);  end  if (isstr(value))    str2=value;  else    str2=num2str(value);  end  lines=[];  for i=1:block.n_lines    [element,estart,eend]=FT_get_element_from_line(block.txt_lines(i),pos);    if (strcmp(element,str2))      lines=[lines,i];    end  end  

⌨️ 快捷键说明

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