필터 지우기
필터 지우기

Is there a way to allocate an array of structs from a .MAT to C?

조회 수: 1 (최근 30일)
MARCELO JUNIO BANDEIRA
MARCELO JUNIO BANDEIRA 2023년 12월 4일
답변: atharva 2023년 12월 7일
Hello!
I need to write the C code for a function I have in Matlab and I thought about using the Matlab Coder. The function basically performs a numeric integration, but there are huge arrays of struct as inputs. I'll be using only C so I need to declare and define these arrays of structs in C.
Does Matlab have a tool to do that?
Thank you!

채택된 답변

atharva
atharva 2023년 12월 7일
Hey Marcelo,
I understand that you want to know that if there is a way to allocate an array of structs from a .MAT to C
However, you will need to manually declare and define the arrays of structs in C. MATLAB Coder provides a way to specify the data types of the inputs and outputs of the generated C code, but it does not generate C code for the data itself. You will need to write the C code to create and populate the arrays of structs based on the input data from your application.
MATLAB Coder has some limitations when generating C code from MATLAB code. Some of these limitations include:
  • Not all MATLAB functions can be converted to C code. For example, functions that use dynamic memory allocation or recursion cannot be converted.
  • Some MATLAB language features are not supported in C code, such as variable-length argument lists and nested functions.
  • The generated C code may not be as efficient as hand-written C code, especially for complex algorithms.
I hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by