Respondida
How can I store a complex number on a binary file?
OK, here are the mex files. There are two separate files, one for writing a single variable (numeric or char or logical) to disk...

más de 13 años hace | 0

| aceptada

Respondida
inv(matrix) takes shorter time than \ operator
1) Your example is so small as to make the timing irrelevant 2) You burden the \ method with creating another variable, B ...

más de 13 años hace | 5

Respondida
Pre-allocating Arrays and Optimizing memory
Some clarification on the use of cell arrays and []: A cell array is an array of variable pointers. That is, the "data" of a ...

más de 13 años hace | 2

Respondida
element in 2D array
Not exactly sure what you want, but here is code to find the minimum value: x = rand(2,2); m = min(x(:));

más de 13 años hace | 1

Respondida
Trimming the Size of a Array of Structures in a MEX file
It is possible to do the equivalent of structOut(cnt+1:end) = [] in a mex routine (see below), but first I would ask if it is re...

más de 13 años hace | 2

| aceptada

Respondida
Is mat.h thread-safe?
The restriction about not "interacting with MATLAB", as you put it, has to do mainly with the MATLAB memory manager, which is no...

más de 13 años hace | 2

| aceptada

Respondida
Sparse matrices: find indices of non-zero elements in C code
Here is a simple mex routine that mimics the display functionality for sparse matrices (prints only the non-zero values). You sh...

más de 13 años hace | 1

| aceptada

Respondida
Can I get faster MatrixMultiplication using CUDA than with Matlab internal GPU implementation??
I'm curious how the times compare to this: C = mtimesx(A,B); MTIMESX can be found here: < http://www.mathworks.com/m...

más de 13 años hace | 1

Respondida
Ideas on why this DLL can be used exactly like a MATLAB function?
It is possible that CgCall is itself a mex routine (has a mexFunction interface etc). What version of MATLAB are you running?

más de 13 años hace | 1

| aceptada

Respondida
How to convert 4 hex bytes into a single integer
Depending on the machine you are on, you may need to use the swapbytes function as well. E.g., try: swapbytes(typecast(uint...

más de 13 años hace | 0

| aceptada

Respondida
Overload mtimes for double*char
The short answer is DON'T DO THIS! There are many built-in MATLAB functions that do (double)*(char) operations and depend on get...

más de 13 años hace | 0

| aceptada

Respondida
How to save a c++ readable Mat file
Are you trying to read the compressed mat file into C++ without the aid of the MATLAB API library? If so, this is not at all tri...

más de 13 años hace | 1

Respondida
i cant understand meaning of this comment . whenever i run program it show this msg. suggest any solution
You have a function that directly or indirectly calls itself. It did so 500 times without returning in your run. That usually me...

más de 13 años hace | 0

| aceptada

Respondida
MATLAB Engine: how to call functions?
Maybe you can adapt this FEX submission, which mimics the capability of mexCallMATLAB with an Engine interface: <http://www.m...

más de 13 años hace | 2

Respondida
Matrix multiplication result - where does it go?
Interesting question. The answer will probably depend on MATLAB version and JIT settings. TMW likely keeps stuffing more & more ...

más de 13 años hace | 2

| aceptada

Respondida
Is there a maximum input size for mex? Segmentation Fault with large inputs
There is a bug in the mxArrayToString API function. It only copies the characters up to the first null character. It does not al...

más de 13 años hace | 2

| aceptada

Respondida
Data type errors in tmwtypes.h while compiling with mex
I suspect the defines -DmwIndex=int -DmwSize=int -DmwSignedIndex=int were intended for older versions of MATLAB (R2006a and earl...

más de 13 años hace | 2

| aceptada

Respondida
Is there a maximum input size for mex? Segmentation Fault with large inputs
What is the connection between len and the size of prhs[1]? How do we know this isn't simply a user input error? I would suggest...

más de 13 años hace | 0

Respondida
How to avoid the compiler error in _kids--Bad rule number 0
The lcc compiler that ships with MATLAB has bugs in it for the unsigned long long type. Your options are: 1) Change to a diff...

más de 13 años hace | 1

| aceptada

Respondida
Random integer number generation
doc randperm

más de 13 años hace | 1

| aceptada

Respondida
Mex compilation with header files
Have you tried the function form of mex yet? I.e., something like mex('-I','...whatever...','simulation.cpp') Also, wha...

más de 13 años hace | 0

Respondida
Mex compilation with header files
If your current directly is the directory that contains simulation.cpp and its associated header files, doesn't simply "mex simu...

más de 13 años hace | 0

Respondida
how to apply relational operators on matrix elements?
i(i>4) = 4; i(i<-4) = -4; or i = min(max(i,-4),4); But in the future avoid i as a variable name since that is wh...

más de 13 años hace | 0

| aceptada

Respondida
Using Mex with Classes
One option is to keep your pointer in a high level variable (i.e., global) and set up a mexAtExit function to clean things up wh...

más de 13 años hace | 0

| aceptada

Respondida
Faster way to initilize arrays via empty matrix multiplication?
Another (perhaps related) observation is that MATLAB does some pre 0 filling in the background in mex routines. E.g., I have run...

más de 13 años hace | 3

Respondida
C++ Mex compilation error. SharedMemory.cpp
It looks like you are missing the definition of the struct mxArray_tag. This used to be part of the matrix.h file up to R2010a, ...

más de 13 años hace | 2

| aceptada

Respondida
Boost mex compilation error > SharedMatrix
The supplied lcc compiler is a C compiler only, not a C++ compiler. You will not be able to compile cpp files with lcc. You need...

más de 13 años hace | 3

| aceptada

Respondida
MATLAB gives error while generating MEX file from the Fortran source code
You are missing the source code for the TEINIT routine, so there is no object routine TEINIT to link to at link time. I.e., some...

más de 13 años hace | 0

| aceptada

Respondida
while true vs. for i= 1:Inf
In addition to what Per Isakson has written, I would add that the loop variable, after a certain point, will lose precision and ...

más de 13 años hace | 1

Respondida
How to use lapack in matlb to solve large eigenvalue problem
If you are well versed in the LAPACK functions and just need an interface, you can use this package from the FEX by Tim Toolan: ...

más de 13 años hace | 1

Cargar más