Questions tagged [matlab-coder]

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.

275 questions
0
votes
1 answer

C++ error when using MatLab dll: one or more multiply defined symbols found

I am trying to use a MatLab function in C++ by using the MCR (MatLab Compiler Runtime). However, I get an error when I call the function from C++. This is the output when I try to build: 1>------ Build started: Project: MatLab DLL Test 2,…
MacHans
  • 53
  • 3
0
votes
1 answer

Matlab coder for "spline" function

Using the built in function of MATLAB coder, which converts matlab to c++, is it possible to convert internal matlab functions like spline? I follow the directions from…
user-2147482637
  • 2,115
  • 8
  • 35
  • 56
0
votes
0 answers

Integrate Code into Visual Studio using MATLAB Coder

I created a dll file from Mathlab .m files using Matlab coder. In matlab, the matlab code runs fine without any error and DLL creation was successful. MV2010 compiles and runs fine. However, when the software calls any function from this DLL in…
ras red2004
  • 169
  • 1
  • 1
  • 10
0
votes
1 answer

Problems with Embedded Functions within Simulink

I'm trying to simulate a very simple model using an embedded matlab function that takes the input and add's 10 to the value using a constant block that inputs into the matlab function, which then outputs to a display block. As soon as I press…
user1574598
  • 3,771
  • 7
  • 44
  • 67
0
votes
1 answer

import function Matlab Coder and C++ executable

Is there any work around for using the "import" function when coverting a matlab *.m file to a C++ executable? Matlab gives me this response: "Import statements are currently unsupported." and I just wanted to know if I was SOL or not. Thanks
Alex
  • 87
  • 7
0
votes
1 answer

Freqeuncy content of a signal inside a simulink model using embedded matlab function block?

I am trying to acquire the frequency information about a displacement signal(e.g., Vx) while the simulation is running. My idea was to make use of the fft command supported by Embedded Matlab Function block. The first thing which i performed was to…
0
votes
2 answers

emxArray_real_T to C# struct plus initialisation

I am trying to create a 'constructor' for this C# struct (initial attempt included): [StructLayout(LayoutKind.Sequential)] public struct emxArray_real_T { public IntPtr data; public IntPtr size; public int allocatedSize; public int…
cs0815
  • 16,751
  • 45
  • 136
  • 299
0
votes
1 answer

assert one dimensional double array of unlimited length (matlab coder)

I am currently using this code: assert(isa(values,'double')); assert(size(values, 1) <= 1000); to persuade matlab coder to make values a one dimensional array. The end aim is to be able to interface with it via C# and PInvoke. This creates a C…
cs0815
  • 16,751
  • 45
  • 136
  • 299
0
votes
1 answer

Matlab code to C using Matlab coder

I have some working Matlab code, which I try to transform into C code using the Matlab coder. I am getting this error: 18 c:\users\bla\project\strcmpi.h(79) : warning C4028: formal parameter 2 different from declaration 19 …
cs0815
  • 16,751
  • 45
  • 136
  • 299
0
votes
2 answers

RMS not supported in Matlab function inside Simulink

Simulink has a module called "Matlab Function," which allows you to create a custom function in a Simulink flow diagram. I implemented a simple function in a Simulink Matlab Function module. My function contains a call to Matlab's built-in rms().…
solvingPuzzles
  • 8,541
  • 16
  • 69
  • 112
-1
votes
1 answer

What is MATLAB's algorithm to calculate histogram with hist function?

I'm working on translation of some old MATLAB code to C++. I have noticed, that my custom function to calculate histogram that supposed to be equivalent to MATLAB [counts,centers]= hist(___) gives different results. I could not find a bug in my…
Albert
  • 13
  • 4
-1
votes
1 answer

C++ SIGTRAP on allocate array

the toolchain I use is Clion MinGW Bundle the original code was generated by matlab Why SIGTRAP occured when tried to allocate memory? #define CODER_NEW(T, N) new T[N] void reserve(SZ _n) { if (_n > capacity_) { T* const…
desperateLord
  • 303
  • 2
  • 9
-1
votes
1 answer

How can I Convert M-file to RISC-V Assembly code?

I am new to RISC-V. I want to convert that MATLAB code(M-file) to RISC-V Assembly code, can anyone give some suggestions or inputs on how can I do it. Regards, Yulia
Yulia
  • 31
  • 8
-1
votes
1 answer

Datatype conversion?

Given a Differential Equation in matrix form: f = @(t,y) [(a*y(1) + b*y(2)); (c*y(1) + d*y(2))]; a=-2; b=-1; c=1; d=-4 Solutions to my differential equation problem are x(t)= e^(-3t) (t+1) y{t)= e^(-3t) *t General Solution is Y(t)= e^(-3t)…
Mary A. Marion
  • 780
  • 1
  • 8
  • 27
-1
votes
1 answer

cell() constructor is not supported for code generation

When I use matlab function block in Simulink. I use another matlab function which contains cell type. But simulink reported error message because of cell. How to avoid this? I'm kind of don't want modify the function because all my functions have…
Pu Zhao
  • 11
  • 3
1 2 3
18
19