MATLAB Coder™ generates standalone C and C++ code from MATLAB® code. The generated source code is portable and readable.MATLAB Coder supports a subset of core MATLAB language features, including program control constructs, functions, and matrix operations. It can generate MEX functions that let you accelerate computationally intensive portions of MATLAB code and verify the behavior of the generated code.
Questions tagged [matlab-coder]
275 questions
4
votes
1 answer
How to use a switch construct with variable-length strings in Embedded Matlab?
I never liked Embedded MATLAB much, precisely because of situations like what I'm about to ask :) In my experience, conversion to Embedded MATLAB often takes a lot more effort than simply re-writing the thing in C (when you know C and the MATLAB API…

Rody Oldenhuis
- 37,726
- 7
- 50
- 96
3
votes
2 answers
Variable named i386 generated by Matlab Coder
I'm generating code for a function with several variable-sized arrays. The code needs to be compiled in both linux (with gcc) and windows machines (with MinGW).
To "ensure capacity" in those variables, Matlab creates several counter variables, named…

Mefitico
- 816
- 1
- 12
- 41
3
votes
1 answer
error: ''cannot convert 'uint8* {aka unsigned int*}' to 'const emxArray_uint8_T*'?'?
I have written a matlab function to calculate entropy of image "ent=entropoy(image)" and convert it to c++ function by matlab coder.
I do some calculation at ent in c++ file then try to convert all c++ code to matlab function.
I received…

samar
- 43
- 5
3
votes
2 answers
Operating on arrays using Unsigned Values
I have been generating a C function from Matlab Coder environnement in order to implement it in an other software called MAX/MSP.
I'm trying to make sense of it, thanks to my poor level in C programming, and there is some syntax elements I can't…

Vic Tor
- 85
- 1
- 4
3
votes
1 answer
Matlab Coder throws mixed field type error in structure array while loading MAT file with coder.load
I'm working on a MATLAB Coder project where I want to load some constant values. After trying many possibilities, all unsuccessfully, I came up with the "coder.load" directive that loads variables from MAT files and assumes them as compile time…

Michele Iafrancesco
- 71
- 7
3
votes
2 answers
Is it possible to embed MATLAB code on Raspberry pi to make standalone hardware device?
I want to realise a computer vision algorithm, coded in MATLAB on a hardware. I know that I can use serial communication to interact with MATLAB and Arduino through pc. But, I want to create a standalone hardware device. Is it possible to accomplish…

Samdish Arora
- 79
- 1
- 8
3
votes
2 answers
Solving ODEs inside a Subsystem in Simulink
I'm trying to figure out how to solve a system of ODEs inside a subsystem in a Simulink model. Basically, each call to this subsystem, which happens at each tick of the simulation clock (fixed-step), entails solving the ODEs. So there's like a…

Bruno
- 1,329
- 2
- 15
- 35
3
votes
2 answers
Output argument not assigned on some execution paths
I am trying to run MATLAB Coder to transform a MATLAB .m file into .mex to hopefully run the code more quickly. When trying to build the file via MATLAB Coder engine, I get the following error:
Output argument 'summstat' is not assigned on some…

user191919
- 724
- 1
- 9
- 27
3
votes
1 answer
MATLAB Coder dynamically sized array of structs
I'm trying to use a dynamically growing array of structs in a piece of code that is supposed to be converted to C with Coder:
I initialize the struct and then declare its fields variable size for coder, then i proceed to grow the struct. Note that i…

sobek
- 1,386
- 10
- 28
3
votes
1 answer
Matlab Coder - Alternative for strcat function
Currently matlab coder is not supporting strcat or strjoin. Is there any anyway to circumvent this or custom function?
Edit:
Input= [a b c d]
Expected output= 'a,b,c,d'

Joel
- 1,650
- 2
- 22
- 34
3
votes
2 answers
How to convert float[][] type array to "emxArray_real_T *x"
I have converted a function which takes a NxN matrix as input and gives a NxN matrix output from matlab to C, using the MatlabCoder.
It gave me the function which has two parameters namely
void func(const emxArray_real_T *x, emxArray_real_T *y)
I…

Gaurav Bansal
- 201
- 2
- 11
3
votes
3 answers
Defining Variable-size input data for Matlab Coder
I'm trying to generate a mex code file from the .m file using Matlab coder. The code for which is
function [result,x]=tesrank(A,x)
result = [];
n = x;
for col= 1:n
result = [result, sum(A==col, 2)];
end
For fixed size, I'm able to get it…

Zero
- 74,117
- 18
- 147
- 154
3
votes
1 answer
adapt wrapper class for two dimensional case
This question is an extension of this question.
I would like to adapt the wrapper for the two dimensional case. This is my first attempt:
public class EmxArrayRealTWrapper : IDisposable
{
private readonly emxArray_real_T _value;
private GCHandle…

cs0815
- 16,751
- 45
- 136
- 299
2
votes
1 answer
Matlab Coder force boolean_T to be native C99 bool type
How can I force matlab embedded coder to set "boolean_T" as "bool" C99 type?
Without that, I need explicit cast conversion I/O signals mapping for int->boolean_t (not needed for int->bool).

David Bonnin
- 302
- 1
- 13
2
votes
2 answers
How to pass structures into re-integrated autogenerated C++ code in Matlab
I am trying to test some code that has been generated from Matlab into C++.
To do this I am attempting to integrate and run the generated C++ code back into Matlab.
Here's the function I am trying to use (in Matlab pre-autogen)
function out =…

TachyonCasio
- 23
- 4