Answered
How to use the dot product within a loop to multiply a series of rows?!
A direct matrix multiply is likely to be faster than using dot. E.g., assuming the variables are real: C = coordNORMALS * V...

12 years ago | 2

Answered
How to read 'long long' from binary file?
For precision use '*int64'. If the file was written on a different machine you may need to deal with endian stuff as well.

12 years ago | 1

| accepted

Answered
How to create an empty struc with fields of a given struct?
One way, which will give you a 0x0 struct, is: f = fieldnames(A)'; f{2,1} = {}; B = struct(f{:}); Method basically...

12 years ago | 6

| accepted

Question


Preferred method to report documentation errors / typos?
To: MathWorks Support Team What is the preferred method these days for reporting documentation errors & typos etc? This Answe...

12 years ago | 1 answer | 1

1

answer

Answered
Error during Mex compilation
It is possible the compiler you are using does not support the uint8_t type (or related types). If so, you might have to manuall...

12 years ago | 1

Answered
What does this mean?
Change 1: Each element of the 2nd row is a cell array. And each of those cell arrays has two elements (1x2 dimension). Each o...

12 years ago | 0

Answered
Multiply a "stack" of matrices with a "stack" of vectors
Some options in the FEX: C-mex code: http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multipl...

12 years ago | 0

Answered
Opposite operation of XOR
a = xor(Cipher,key)

12 years ago | 3

Answered
Datenum: how many seconds in a day?
With regards to the datenum and related functions, MATLAB days are exactly 24h (86400s) always. There *is* accounting for leap d...

12 years ago | 5

| accepted

Answered
MATLAB crashes when I run MEX file - HELP
I don't see any place in your code where you allocate temp. So the first time you use it you dereference an invalid pointer, and...

12 years ago | 1

Answered
Matlab code for Euler's method
Look at this link: http://en.wikipedia.org/wiki/Euler%27s_method Look at the "Formulation of the method" and "Example" sec...

12 years ago | 1

Answered
What extra data is stored by an anonymous function?
This topic has already been addressed in this thread: http://www.mathworks.com/matlabcentral/answers/65963-function-handles-a...

12 years ago | 0

Answered
Crash during mxCopyReal8toPtr in Fortan 90 Mex File when Arrays are Large
I haven't looked at your code in any great detail, but one thing I noticed was this: call mxCopyPtrToReal8(mxGetData(PR...

12 years ago | 2

Answered
How implement constrain of being positive in Nelder-Mead Method?
Another trick is to return f(x) = infinity whenever any of the x(i) are not positive. Have your starting guess all positive and ...

12 years ago | 2

Answered
Error using mex (line 206) Unable to complete successfully.
Usually the file-not-found error is because the 'GraphCutMex.cpp' file is not in the current default directory. E.g., can you se...

12 years ago | 0

Answered
Calling mex sub-routines - runs out of memory? Any specific destroyArray required for prhs after using it?
No, you should not be calling mxDestroyArray for any of the prhs after using them. What does the utc2UT1 routine look like? Are ...

12 years ago | 1

Answered
Parsing problems with Matricies in C++ Mex Files
You are printing out a double floating point value using an integer format %d. Use a floating point format instead (%f, %g). E.g...

12 years ago | 2

| accepted

Answered
Segmentation error in mex file
I don't see anywhere where you allocate field_names: const char **field_names; /* pointers to field names */ :...

12 years ago | 1

| accepted

Answered
"Unable to locate 'mexopts.bat', and therefore cannot determine which compiler to use for simulation builds. Use 'mex -setup' to select a supported compiler." I am getting this error. Suggest me what to do.
At the MATLAB command line, type exactly what the error message told you to type: mex -setup Then press Enter when it as...

12 years ago | 0

| accepted

Answered
mxGetPr crashing for no reason
If you want to operate on a calling workspace variable in-place iteratively, you will have to pass that variable into the mex ro...

12 years ago | 0

| accepted

Answered
how to get the length of a array?
Pass the length of the "array" as part of the argument list. You can't get this info by simply examining the "array" pointer its...

12 years ago | 1

Answered
Matlab engine - C++ doesn't call matlab function written by myself
The Engine starts up with the default folder, so if your function is not on the path at start up then the Engine will not see it...

12 years ago | 0

| accepted

Answered
Guidance in writing mexFunction for convert.c
Try putting this at the top of the file and then mex it: // One input argument: The Filename int main(int argc, char **a...

12 years ago | 1

| accepted

Answered
Highly variable execution time of mex file
I have no real explanation for this behavior (underlying cache system?), but I have noticed it on many occasions for some of my ...

12 years ago | 1

Answered
Get the data in rows and/or columns from a matrix in a MEX file
The signature for ddot from this link: http://www.netlib.org/blas/ is: DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX...

12 years ago | 0

| accepted

Answered
Can someone write an example of using the secant method to find roots of equations?
You can find an example here: http://en.wikipedia.org/wiki/Secant_method

12 years ago | 2

| accepted

Answered
How to Read Fortran 90 Unformatted Binary Files into Matlab
See this thread for an example of reading Fortran unformatted binary data into MATLAB: http://www.mathworks.com/matlabcentral...

12 years ago | 0

Answered
Question on the use of function 'load' to open a *.mat file
The statement: load File is equivalent to: load('File') What you want to do is load(File) This is a ge...

12 years ago | 0

| accepted

Answered
why does preallocating space for array of structures by brute force leave my editor upset?
As shown, I agree that s is already allocated for the 2nd loop. The editor may simply not be smart enough to recognize this. Is ...

12 years ago | 0

Answered
error LNK2019: unresolved external symbol when compiling MEX
You mention a library file FDT2XX.lib but I don't see you use it. Do the functions in ftci.cpp depend on this library? If so, tr...

12 years ago | 1

Load more