find_index.m

来自「Simulation of Wimax network」· M 代码 · 共 23 行

M
23
字号
function index = find_index(num,table)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                       %
%%       Name: find_index.m                                              %
%%                                                                       %
%%       Description: It receives a table and a number to look for in    %
%%        first column.                                                  %
%%                                                                       %
%%       Result: It gives back the corresponding value of the second     %
%%        column.                                                        %
%%                                                                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dim = size(table);
num_col = dim(1);

for i=1:num_col
    if num==table(i,1);
        index = table(i,2);
        return
    end
end

⌨️ 快捷键说明

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