lookuptable1d.c

来自「利用Stateflow 进行嵌入式代码开发很好用」· C语言 代码 · 共 22 行

C
22
字号
/* This file is an example legacy lookup table source file */
/* The object of this example is to interface to the the lookup functions below */

#include "your_types.h"
#include "lookupTable.h"

/* 1D Lookup Tables */
/* The table algorithms implement a kinda close lookup method for simplicity sake */

FLT lookupTable1D(const FLT *InputMap, const FLT *OutputMap, const UINT MapLength, FLT InputValue)
{
  int idx = 0;
  FLT result;

  /* Search for the Element in the InputMap Above the Input Value*/
  while ( (idx < (MapLength-1)) && (InputMap[idx] < InputValue) )
    idx++;
  
  result = OutputMap[idx];
  return result;
}

⌨️ 快捷键说明

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