How to declare variables in C as int16/uint16/int32 etc, for S function

6 ビュー (過去 30 日間)
Matthew Davis
Matthew Davis 2016 年 8 月 21 日
回答済み: Matthew Davis 2016 年 8 月 21 日
I'm writing some C code, to compile and use as an S function in simulink.
In normal C programming, I can just declare variables to be a certain size, like
int16 x = 5;
uint32 y = 7;
But when I try that in matlab, and compile it with
mex file.c file_wrapper.c
I get an error message:
unknown type name ‘int32’
I've tried `Int32' and `int_32' and neither works.
Is there some library I need to include?
Mex gives me the following warning. Is it related to this?
Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is
'4.7.x'.

採用された回答

Matthew Davis
Matthew Davis 2016 年 8 月 21 日
I found the answer.
  • Add tmwtypes.h as a library
  • Use `int32_T` as the type.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by