Respondida
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...

más de 15 años hace | 0

Respondida
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...

más de 15 años hace | 0

| aceptada

Respondida
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) = {[]};

más de 15 años hace | 1

| aceptada

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

más de 15 años hace | 3

| aceptada

Respondida
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...

más de 15 años hace | 0

| aceptada

Respondida
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...

más de 15 años hace | 0

| aceptada

Respondida
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,...)

más de 15 años hace | 1

| aceptada

Respondida
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...

más de 15 años hace | 5

| aceptada

Respondida
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 ...

más de 15 años hace | 2

| aceptada

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

más de 15 años hace | 0

Respondida
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 ...

más de 15 años hace | 0

| aceptada

Respondida
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...

más de 15 años hace | 0

Respondida
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...

más de 15 años hace | 0

Respondida
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. ...

más de 15 años hace | 1

Respondida
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...

más de 15 años hace | 2

| aceptada

Respondida
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...

más de 15 años hace | 1

Respondida
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...

más de 15 años hace | 2

| aceptada

Respondida
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...

más de 15 años hace | 0

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

más de 15 años hace | 0

| aceptada

Respondida
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...

más de 15 años hace | 0

Respondida
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...

más de 15 años hace | 0

Respondida
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...

más de 15 años hace | 4

| aceptada

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

más de 15 años hace | 1

Respondida
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-...

más de 15 años hace | 2

Respondida
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...

más de 15 años hace | 3

Respondida
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...

más de 15 años hace | 0

Respondida
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...

más de 15 años hace | 0

Enviada


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

más de 15 años hace | 1164 descargas |

5.0 / 5
Thumbnail

Respondida
Double precision
I didn't know double precision was broken. You can get higher precision with the Symbolic Toolbox. Or if you only need integers,...

más de 15 años hace | 1

| aceptada

Respondida
pseudo-random number generator rand() in .mex
When you first run a mex function it loads into memory and stays in memory until it gets cleared. So any variables that are glob...

más de 15 años hace | 0

| aceptada

Cargar más