Answered
Data from MEX-File to MATLAB
The prhs[ ] is an array of input variables, and plhs[ ] is an array of output variables. MATLAB will allocate a fixed number of...

15 years ago | 0

Answered
MEX problem with mxGetData
When you use the curly braces { } in MATLAB you are building a cell array, so you need to use mxGetCell in your mex routine. E.g...

15 years ago | 2

| accepted

Answered
32-bit MEX file (Fortran) works correctly, the same 64-bit MEX file causes "Segmentation Fault"
A Fortran default integer is almost certainly an integer*4, even for 64-bit compilers. Compiler vendors typically do this so tha...

15 years ago | 0

Answered
Bug in single/double operations?
This exact issue has already been discussed on the newsgroup, with the JIT being the likely cause of the difference: <http://ww...

15 years ago | 0

| accepted

Answered
Is there an easy way to replace NaNs with empty cells when converting a numeric array to a cell array.
e.g., A = your double array; C = your cell array; idx = isnan(A); C(idx) = {[]};

15 years ago | 1

| accepted

Answered
3D matrix multiplication
M = mtimesx(A,B); You can find MTIMESX here: <http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-m...

15 years ago | 3

| accepted

Answered
Moving Complex Data to a .mat file from a C Program
The answer will depend on how the data is currently stored in your C variable. If the C data is stored as a single variable in...

15 years ago | 0

| accepted

Answered
Using mexCallMATLAB to instantiate an object ?
You can't use any of the mex___ API functions with the MATLAB Engine, you have to use the eng___ API functions. Since there is n...

15 years ago | 0

| accepted

Answered
Find smallest FIVE elements in a vector
See the 2nd output of the sort function giving the original indexes of the sorted values. [B,IX] = sort(A,...)

15 years ago | 1

| accepted

Answered
Why are the results of the size function different from the whos function Size?
Doing this: size excelstring Is equivalent to doing this: size('excelstring') Whenever you invoke a function wit...

15 years ago | 5

| accepted

Answered
Mex Fortran Gateway Function
OK, here is some code you can try (CAUTION: UNTESTED). Uses the Fortran 95 MATLAB interface code from the FEX I mentioned in an ...

15 years ago | 2

| accepted

Answered
Mex Fortran Gateway Function
Please provide the exact interface for this routine: subroutine crvfit(xfit,yfit,xfite,yfite,imode,yfit2,nptsf,delfac) ...

15 years ago | 0

Answered
MEX File, UBUNTU, .so files
If I understand you correctly, you have C++ source file(s) and some other object files and you want to build a mex routine from ...

15 years ago | 0

| accepted

Answered
Use of 3D array. Find inverse of individual page
See this small size linear solver by Bruno Luong: <http://www.mathworks.com/matlabcentral/fileexchange/27762-small-size-linea...

15 years ago | 0

Answered
MATLAB API automation
Just don't close the engine. i.e., don't call engClose at the end of your program. Once the program ends, your MATLAB Engine ses...

15 years ago | 0

Answered
Specify runtime path with mex
The parser doesn't always give you what you expect when you include all of your inputs on the command line like you have shown. ...

15 years ago | 1

Answered
C++ comments in Mex files under Linux
Probably it's the same reason they still include the silly "/fixed" option on the Fortran mexopts.bat files (which forces free-f...

15 years ago | 2

| accepted

Answered
How to find vector elements between two values, efficiently
You can try a mex approach. The following file does the exact calculation shown above. If you need to modify it for different co...

15 years ago | 1

Answered
binary generator
See the rand function. There are various ways to get 0 1 results depending on what you are doing with it downstream. Do you want...

15 years ago | 2

| accepted

Answered
Problem passing large array between matlab and mex function
The first thing I would do would be to examine all of the function/subroutine interfaces that you use and make sure they are cor...

15 years ago | 0

Answered
minimization problem -using simplex method
Which Simplex Method? Dantzig or Nelder-Mead?

15 years ago | 0

| accepted

Answered
Extracting parts of a matrix implicitly (without storing the matrix)
You can do what you show directly in Fortran, and kinda do it in C, but MATLAB has no official way of pointing to parts of other...

15 years ago | 0

Answered
Handling Pointers in C++ library
MATLAB stores character data as 2-bytes per character. You can get a pointer to the character data with mxGetData, and pass that...

15 years ago | 0

Answered
cell array or multidimensional array?
Depends on what you are doing with the data downstream. If you are accessing array slices of A a lot, then the cell array approa...

15 years ago | 4

| accepted

Answered
Why do you come to "MATLAB Answers"?
j. To see how much farther back my reputation points are compared to Walter and Matt.

15 years ago | 1

Answered
Wrong values with greater than, equal and less than or equal functions
You might find this utility useful: <http://www.mathworks.com/matlabcentral/fileexchange/22239-num2strexact-exact-version-of-...

15 years ago | 2

Answered
When to break the MATLAB rules?
In-place operations in mex routines when the variables are huge and you can't afford the extra copies that MATLAB would normally...

15 years ago | 3

Answered
when I make sparse matrix in C-MEX , eigs fuctions call doesn't work
See this FEX submission by Tim Davis to help you diagnose sparse matrix formation problems in a mex routine: <http://www.math...

15 years ago | 0

Answered
converting to/from C++ arrays to mxArrays
pdata *is* a regular C++ pointer and can be used as a regular C++ array in most contexts. Try checking the API results to see th...

15 years ago | 0

Submitted


UNINIT - Create an uninitialized variable (like ZEROS but faster)
UNINIT is similar to ZEROS, except UNINIT returns uninitialized values instead of zero values.

15 years ago | 1164 downloads |

5.0 / 5
Thumbnail

Load more