Answered
matrix multiplication
Another way: [m n] = size(A); Ar = reshape(A,m,1,n); B = reshape(mtimesx(Ar,Ar,'t'),m,m*n).' You can find mtimesx ...

14 years ago | 0

| accepted

Answered
can't run MEX files on Matlab 7.10 (R2010a)
The file arrayProduct.c is not in the current directory. You need to copy that file into the current directory, or change the cu...

14 years ago | 1

Answered
Transposing 3 D matrix using permute - how does permute work?
Another way to do 2D slice transposing of an nD Array: mtimesx(1,A,'t') You can find mtimesx on the FEX here: < ...

14 years ago | 1

Answered
How can I get HINSTANCE from .mex?
It would easier if you use just one mex routine and passed in a flag that determined the behavior. However, if you insist on pas...

14 years ago | 1

Answered
Invalid MEX-file, invalid win32 application
This message can result when a mex routine is compiled with one version of MATLAB and then used on a different version of MATLAB...

14 years ago | 1

Answered
Passing structures through mex
E.g., the following code snippet w/o any argument checking, assuming you pass in the structure sys as the first argument: ...

14 years ago | 2

| accepted

Answered
I call a mex function and do some operations with its results and then matlab crashes
You should never use mxDestroyArray on any of the plhs[*] values ... that will guarantee a MATLAB crash since MATLAB will attemp...

14 years ago | 1

Answered
Bug when using min() with sparse matrices?
You might try using this to check the matrix: href=""<http://www.mathworks.com/matlabcentral/fileexchange/20186-spok-checks-if-...

14 years ago | 1

| accepted

Answered
issue related to mex file in matlab
In general, mex routines are not backward *or* forward compatible. It all depends on what versions you are running, which OS you...

14 years ago | 0

Answered
Sparse Matrices and Machine Precision
If you are really desperate for speed one could write a mex routine to do this operation in-place. My guess is it probably would...

14 years ago | 1

Answered
how to make a mex 'answer' nargin/nargout
You could have a companion m-file with the same base name, foo.m, with the same signature as the mex routine, and then use nargo...

14 years ago | 0

Answered
Mex
The "return" statement error was pointed out several days ago in OP's previous thread, it just wasn't corrected. In addition, th...

14 years ago | 0

Answered
converting to mex
Repeating my response from the newsgroup here just to complete this thread: Try to access the data only once (i.e., drag it thr...

14 years ago | 1

Answered
Using structures in MEX files
I see the following issues: 1) You don't check your inputs before you use them. I would recommend putting in code to check that...

14 years ago | 1

| accepted

Answered
contiguous memory for complex arrays in mex
Yes and No. It is easily possible to physically do this, but the clearing of such a variable will likely crash MATLAB if you are...

14 years ago | 1

| accepted

Submitted


Fortran 95 Interface to MATLAB API with extras!
This is the one you have been waiting for, a clean interface using assumed shape Fortran pointers.

14 years ago | 1 download |

5.0 / 5
Thumbnail

Answered
MEX Function - Using mexCallMATLAB function in conjunction with "PolyFit"
You don't need to make pm, pp, and fit_order arrays. Try this: double *pmp, *ppp; mxArray *rhs[1], *lhs[1]...

14 years ago | 0

Answered
Fortran and matlab
The engine will need to be opened first using engOpen to get the ep to pass to engCallMATLAB. I assume you are using my engCallM...

14 years ago | 0

Answered
error occurred when using mex to build binary MEX-file
You need to include *all* of your source code on the mex command line unless it is included in the other files. e.g., mex d...

14 years ago | 2

Answered
Converting Decimal to Hexadecimal without the use of the dec2hex function.
I will get you started with one approach. You could start with a char array like this: hexdigits = '0123456789abcdef'; T...

14 years ago | 0

Answered
Writing ints and unsigned ints to .mat files in a C++ program
Consider these lines from your code (in particular the last line): mxArray *tempMat; tempMat=mxCreateDoubleMatrix(1,1,...

14 years ago | 1

Answered
Writing ints and unsigned ints to .mat files in a C++ program
You need to show more of your code. E.g., what is time_step? How is it declared and initialized? It needs to be MATLAB allocated...

14 years ago | 2

Answered
Identical math operations in C++ and matlab differ by ~1% (10^11 in this case!)
Differences can arise from different order of operations, temporary results done in 80-bit vs 64-bit arithmetic, different round...

15 years ago | 1

Answered
fortran 90 mex on Mac
Is there a "/fixed" option (or similar) on the COMPFLAGS line in the mexopts file? If so, remove it. That is the typical problem...

15 years ago | 0

Answered
Fortran 10.0.026
You might get things to work by copying the v9 mexopts files into new v10 named files and then modifying the contents of these n...

15 years ago | 0

Answered
Using mexMakeMemoryPersistent to save C data structures
mexMakeMemoryPersistent only works for MATLAB API allocated memory using mxMalloc, mxCalloc, and mxRealloc. It will not work wit...

15 years ago | 0

Answered
Funtion to get 9th term in an array
A(1:9:end)

15 years ago | 0

| accepted

Answered
random number within a rwo vector
A(ceil(rand*numel(A)))

15 years ago | 0

| accepted

Answered
Calling matlab functions from a C code
See the External Interfaces section of the doc, and in particular the mexCallMATLAB function.

15 years ago | 0

Answered
recover basic rotations
You should take a look at SpinCalc in the FEX by John Fuller: <http://www.mathworks.com/matlabcentral/fileexchange/20696-func...

15 years ago | 1

Load more