select_records.m

来自「用于OMNeT++的模板」· M 代码 · 共 23 行

M
23
字号
function result = select_records(data, condition)if( nargin!=2 )  usage("select_records(data, condition)")endifj=1;for i=1:size(data,1) # for each data row, see if the condition is true  datarow=data(i,:);  if( eval(condition) ) # if so, copy it to the top of the list of rows we keep    data(j,:) = data(i,:);    j=j+1;  endifendforresult=data(1:j-1,:);endfunction

⌨️ 快捷键说明

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