주요 콘텐츠

이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

C 코드 구문를 위한 모델링 패턴

특정 C 구문을 생성하는 모델링 패턴 적용

생성된 코드에서 특정 C 구문을 생성하기 위한 모델을 설정하는 데에는 여러 가지 표준 방법을 사용할 수 있습니다. 블록, S-Function, Stateflow 차트, MATLAB 함수 블록, 데이터 객체 및 사용자 지정 스토리지 클래스를 사용하면 데이터형, 구조체, 배열, 제어 흐름 구조, 함수, 전처리기 지시문 및 포인터와 같은 C 구문을 생성할 수 있습니다. 시작하려면 Prepare a Model for Code Generation 항목을 참조하십시오. 표준, 지침 및 블록 사용 항목도 참조하십시오.

도움말 항목

유형, 연산자 및 표현식

제어 흐름

  • If-Else
    Use a Switch block, a Stateflow Chart, or MATLAB Function block to create an if-else statement in the generated code.
  • Switch
    Use a Switch Case block or MATLAB Function block to create an switch statement in the generated code.
  • For Loop
    Use a For-Iterator Subsystem block, Stateflow Chart, or MATLAB Function block to create a for loop in the generated code.
  • While Loop
    Use a White Iterator Subsystem block, Stateflow Chart, or MATLAB Function block to create a while loop in the generated code.
  • Do While Loop
    Use a While Iterator Subsystem block or Stateflow Chart to create a do while loop in the generated code.

함수

  • Function Call
    To generate a function call, add a subsystem, which implements the operations that you want.
  • Function Prototyping
    Create a function call using graphical functions or function prototype control.
  • External C Functions
    Integrate legacy C functions in the generated code by either creating an S-function or making a call to an external C function.

전처리기 지시문

구조체

배열

포인터

  • Pointers
    Generate code that accesses data from your handwritten code through a pointer.