274 questions
1
vote
0
answers
879
views
Matlab Coder; Subscripting into an mxArray is not supported
Using matlab coder, I get Subscripting into an mxArray is not supported. error in the following function:
function net = mlpunpak(net, w)
% Check arguments for consistency
errstring = consist(net, '...
1
vote
0
answers
256
views
matlab interp2 with coder
I am trying to generate a mex file from my code using matlab's coder. I'm using interp2. Only when running the mex file I get an error "Grid values must be strictly increasing."
It seems that the grid ...
0
votes
1
answer
684
views
Using Matlab Coder generated C files on Qt Creator
I am trying to use Matlab Coder generated C code on Qt Creator. However, whenever I try to build my project, I get an undefined reference error.
Here are some details about the setup:
I set the ...
1
vote
2
answers
1k
views
Matlab audioread/audioplay into C/C++ through Coder
I am working on a matlab project where I add effects to audio files (mp3, wav). Therefore, I load the files into arrays using the matlab function audioread(..).
Now, I want to export this to Android. ...
0
votes
1
answer
5k
views
MAP must be at least 'm x 3 array' error in MATLAB
I am trying to generate C code with the MATLAB Coder. The input to the function is an image that has been processed by imread within MATLAB. Since the output should be an m x n x 3 array from imread, ...
2
votes
1
answer
1k
views
Alternatives to extrinsic functions such as imread and other functions during code generation in MATLAB
As you may know, extrinsic functions are not outputted during the code generation process. Are there alternatives to these functions and/or solutions to this problem? My code generation error report ...
1
vote
1
answer
911
views
Problems with using mxarrays with the step function in MATLAB Coder
I'm trying to convert my image processing code on MATLAB into C by using MATLAB coder. using imread needs a coder.entrinsic declaration. However, this means that the output to imread will be an ...
3
votes
2
answers
3k
views
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:
...
1
vote
1
answer
1k
views
Convert Matlab m files into C/C++ codes using Matlab Coder, including mex files (mxArray)
I'm using Matlab Coder to generate C/C++ codes from a matlab .m file, which calls external C/C++ functions. I did some work and found "code.ceval" made it worked.
But it gets complicated when the .m ...
0
votes
1
answer
618
views
Function/s equivalent to "bwareaopen" and "bwconhull" supported for C / C++ code generation (MATLAB)
This is with reference to a code suggested by Image Analyst given here. I am trying to generate C code for the algorithm. According to the document "Functions and Objects Supported for C and C++ Code ...
8
votes
1
answer
259
views
How to identify places in MATLAB where data is stored outside the bounds of an array?
I am trying to use MATLAB Coder to convert code from Matlab to a MEX file. If I have a code snippet of the following form:
x = zeros(a,1)
x(a+1) = 1
then in Matlab this will resize the array to ...
1
vote
1
answer
817
views
Creating standalone butter filter with Matlab coder
i'm trying to compile with Matlab Coder a custom function which includes a butterworth filter.
I've extracted the lines that give me problem with the Matlab coder function.
function [output] = ...
0
votes
1
answer
638
views
C++ Code used in MATLAB code
I have a MATLAB code and its using a C++ code.
When I try to build it using MATLAB Coder i am getting an error
Undefined function or variable 'nameOfC++file'.
How do I include / define it before ...
1
vote
1
answer
699
views
Matlab coder & dynamic field references
I'm trying to conjure up a little parser that reads a .txt file containing parameters for an algorithm so i don't have to recompile it everytime i change a parameter. The application is C code ...
0
votes
0
answers
332
views
mex file generated by Matlab-coder: how to re-compile
I recently got some of my Matlab code converted to C and it works. However, I would like to make some changes to these mex file and recompile.
So far, I have only worked with simple mex project: ...
0
votes
1
answer
2k
views
Matlab with external C++ function: coder.ceval pass a structure to a function
I’m trying to pass a Structure from a Matlab function in Simulink to an external C++ function using the coder.ceval() and the coder.cstructname(). When I try to run the code on an Arduino Due board ...
0
votes
0
answers
143
views
Solving Linear Equations in Level-1 S-Function Versus Matlab Coder
I have a matlab level-1 s-function that I use to solve a system of linear equations. Unfortunately, my simulations are very slow, and the Profiler Report tells me that this particular s-function is ...
0
votes
1
answer
263
views
Datatype mismatch with arduino and coder.ceval
I'm writing a simulink device driver block for Arduino Due with the Matlab Function Approach as explained in the Simulink Device Driver guide. When I want to pass a double from the C++ code to the ...
0
votes
1
answer
2k
views
Including libraries in the custom code section in Simulink
I'm trying to Include some Libraries, like metis in the custom code library section in Simulink. Do you know what type of libraries Simulink excepts? Must they have the ending .a, .o, .dll or lib?
...
0
votes
1
answer
418
views
Including c libraries in the custome code section of Simulink
I'm trying to include Csparse from SuiteSparse in to Simulink.
I've included the header ch.h and the directory of the c-functions in the custom code section.
If I call the function cs_compress over ...
0
votes
2
answers
3k
views
How to give a structure with arrays in simulink to a custom C code function?
I'm trying to give a structure to a C function in Simulink. My steps so far:
Included the .h & .c in configuration parameters custom code. My header has a structure defind:
typedef struct ...
0
votes
1
answer
215
views
I am developing a DLL using Matlab coder.I need to fill the properties and details like copyright,file version,product name etc for the created dll
I have a query regarding Matlab Coder .I am developing a DLL from .m files using Matlab coder(R2014a).I need to fill the properties and details like copyright,file version,product name etc.. of the ...
1
vote
0
answers
681
views
cell array isn't supported by Matlab coder
I have a list of matrices. I want to use Matlab coder to get the corresponding c code and hence run the program faster. However, cell array is not supported in Matlab coder. Is there any other way to ...
0
votes
1
answer
117
views
MATLAB : Which location the MATLAB 2 C source code is generated
I just ran a successful command to convert a MATLAB .m file to C source code
>>codegen -c abc.m
>>
However I see the ">>" prompt again after command has finished (no errors, warnigs ...
0
votes
2
answers
2k
views
Passing array in struct by reference to coder.ceval
I have a struct with very large arrays in it. I use MATLAB coder to generate C code.
In my generated code I wish to call some C function and pass by reference one of the arrays.
For example:
coder....
2
votes
1
answer
238
views
Matlab-generated Dll in C
I created a dll of a simple function in Matlab using this command:
mcc -t -L C -W lib:testfunctionLib -T link:lib testfunction.m libmmfile.mlib
The simple function looks like:
function y = ...
0
votes
1
answer
3k
views
Any Tic Toc function in Simulink for embedded blocks
I have a system with some embedded Matlab blocks where I'd like to perform some actions after a certain amount of time, in this case turn on lights and switches in an interface to which I send signals ...
1
vote
1
answer
510
views
Problems Linking Matlab generated C++ Library
I want to use Code generated from the Matlab C/C++ Coder in my C++ Code.
Matlab creates the Files in the right way, and brings also a Makefile with it, to create a Library. I think, I linked the ...
0
votes
0
answers
233
views
matlab codegen linking/embedding mex
Ok so I developed a code in MATLAB with numerous nested loops that cannot be vectorized.
To speed up processing I "codegen" this file. The problem here is that I am calling a function which is in gcc (...
0
votes
1
answer
1k
views
How to use Matlab embedded coder under Windows to compile for LINUX?
I'm trying to compile a Simulink algorithm to a CarPC. The CarPC is based on a Intel Atom processor and runs in LINUX. The idea is compile the Simulink code with the Matlab embedded coder to the ...
0
votes
2
answers
2k
views
Run Matlab Coder Output Project on Visual Studio or g++
I wanted to convert my simulation code in Matlab to C++ and run it with a C++ compiler such as Visual Studio or g++. I modified my code to successfully build a C++ project using Matlab Coder.
The ...
-1
votes
1
answer
3k
views
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 ...
0
votes
1
answer
371
views
3D Matrix in Simulink which can be 2D is not supported
I am using SIMULINK and I needed to define a Rotation Matrix 3,3,N where N is the number of Robots which I am trying to simulate. To do that, because I am also using the Simulink Coder I had to define ...
0
votes
1
answer
111
views
Error while compiling to LINUX Matlab Code with MatlabR2012a
I am trying to compile a Matlab function to C.
Here you have the declaration of the function:
function [SpdLmt0, SpdLmt1, SpdLmt2, SpdLmt3, SpdLmt4, SpdLmt5, SpdLmt6,
SpdLmt7, SpdLmt8, SpdLmt9, ...
0
votes
2
answers
2k
views
3D Matrix as output of a Matlab Function in a Simulink model
I have the following problem.
I have a SIMULINK model and in this model I have a block: Matlab Function, the following
http://it.mathworks.com/help/simulink/slref/matlabfunction.html
To my function ...
1
vote
1
answer
285
views
matlab coder: cannot transpose a matrix that is incorrectly deemed to be 3-D when it should always be 2-D
I have a function (with the code given below) that I wish to convert into a MEX file. I am trying to use matlab coder to do so.
%% Inputs
dof = 3;
num_divs = 72;
ind_cr =
0 0
1 1
...
0
votes
1
answer
120
views
How can I make MEX files created by the Coder toolkit usable by others
I have created a MEX file using MATLAB's Coder toolkit, and it works perfectly fine on my computer, however, when I sent it to someone else for their use, it error and would not work.
What are the ...
0
votes
1
answer
1k
views
alternatives to lsqlin MATLAB
Ok so I have a script that runs among other things lsqlin optimization function millions of times. To speed up this code I "codegen" it (basically automatically creates some mex files). This is a ...
0
votes
1
answer
243
views
MATLAB expression 'Mf' is not of the correct sparseness
Hello Im trying to transform a function to a .mex function through the command "coder". One of my inputs is a sparse double matrix. when the coder asks to define the type of the variable 'Mf' I setit ...
1
vote
1
answer
150
views
Is a there a Coder Product (Embedded, Simulink,or Matlab) which supports version 2010SP1
I am looking for a product which will convert my Matlab code into C++ code. I have looked into Matlab Coder extensively but it seems that it will not suffice as it is only compatible with versions of ...
2
votes
2
answers
451
views
MATLAB: MEX matrix division gives different result than m-file
I've used MATLAB's coder tool to create a MEX version of the matrix exponential function, to be used in another set of functions. The issue is, the MEX version gives different results than the ...
1
vote
1
answer
101
views
Mexed function gives very slight difference when performing math
So I tried the matrix exponential function using MATLAB's Coder toolkit, and I got it to build. I went on to test to see if the results were reliable and more efficient. While the code was faster, the ...
1
vote
2
answers
3k
views
Get Errors when running Simulink block, but get Success when running respective M-file alone
I would like to transmit an encoded image using USRP. The first step is to load the image using Matlab and encode it. The respective codes are shown as follows.
function msg = genMsg1
%#codegen
...
0
votes
1
answer
2k
views
How do I create a global Array that increases in size in Simulink
I would like to create a global array within a Matlab function block in Simulink that grows in size, each time the Matlab function block is called. The only approach to create global variables in a ...
0
votes
1
answer
1k
views
IntelliSense error identifier "emlrtStack" is undefined
I am converting a MATLAB written function into C by "Matlab coder". After I get the converted files , the converted function always have first input argument as const emlrtStack *sp. Now when I am ...
0
votes
1
answer
433
views
MATLAB Coder giving out-of-bounds error for struct
I am trying to MEX some code by using MATLAB's coder toolkit. The code initially had cell arrays in it which is not handled by the coder at the moment, so I decided to use structs in compensation for ...
0
votes
1
answer
1k
views
Can we implement MATLAB code on Android? [duplicate]
I basically am using MATLAB for image processing. I want to develop an Android app which can support the processing provided by MATLAB. I searched for results about it but failed to get clarity out of ...
0
votes
1
answer
524
views
MATLAB Coder function is undefined in 2014a
I am trying to convert the expm function for calculating the exponential of a matrix from C++ to Mex, in order to increase efficiency. However, this would be a very arduous task to convert the C++ ...
3
votes
1
answer
2k
views
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 ...
0
votes
2
answers
835
views
Matlab Codegen build error
I am trying to convert the below Matlab code into C++ using codegen. However it fails at build and I get the error:
"??? Unless 'rows' is specified, the first input must be a vector. If the vector ...