Answered
Mex/Fortran passing data
Download this package from the FEX: <http://www.mathworks.com/matlabcentral/fileexchange/25934-fortran-95-interface-to-matlab...

14 years ago | 2

| accepted

Answered
Writing MAT file from c++. I have fully compiled code but values come out odd.
Walter has noted your problem already, but I would point out that this is not the best way to go about things. You can avoid the...

14 years ago | 0

| accepted

Answered
Mex Files and Variables in the Matlab Workspace
This is called "shared data copy", or "copy-on-write", or "lazy copy" in various contexts. I will be producing a guide to all of...

14 years ago | 3

Answered
Why is (2.24*10)-22.4 not equal to 0?
>> num2strexact(0.3) ans = 0.299999999999999988897769753748434595763683319091796875 >> num2strexact(0.2) ans =...

14 years ago | 3

| accepted

Answered
fortran matlab
Stack space typically comes from local variables and intermediate calculations. Try to avoid these for large variables. Use allo...

14 years ago | 1

| accepted

Answered
Matlab mex memory handling - same input different result
Cross-posted in the newsgroup, so I will repeat my reply here: What does the BladeElementGC interface look like? Normally I w...

14 years ago | 0

Answered
Fortran interface advice
See this package and use the fpGetPr0, fpGetPr1, and fpGetPr2 functions to copy data into and out of the mxArray: <http://www...

14 years ago | 0

Answered
memory space for cell array
A MATLAB variable consists of: Structure (about 60 bytes on a 32-bit system, a bit more on 64-bit systems) containing informa...

14 years ago | 11

| accepted

Answered
mexCallMATLAB ... Help me please.
mxArray *A; double *d; A = mxCreateNumericMatrix(1, 1, mxDOUBLE_CLASS, mxREAL); d = mxGetPr(A); ...

14 years ago | 1

Answered
Mex implemeentation
Copy the file yprime.c from the MATLAB directory it is located in to your current working directory. It can be found in: [m...

14 years ago | 0

| accepted

Answered
how deal with time stamp with unix seconds?
Everything you need is in the link you provided. E.g., >> datestr(881250949/86400 + datenum('1/1/1970')) ans = 04-Dec...

14 years ago | 0

| accepted

Answered
Converting vector to binary and summing it
What is the range of your numbers? You might be able to simply convert them to double, then add them, then mod the result with ...

14 years ago | 0

Answered
Error with simple mex file
For a file ending with extension .F the compiler assumes fixed form format for the source code. This means: Columns 1-5 are t...

14 years ago | 0

| accepted

Answered
Maximize size of a 3D matrix
Maybe use a different class: q = randi([0 10],38000,50,100,'int8');

14 years ago | 0

| accepted

Answered
Printing Sparse Matrix in mex function in CCS format
To print out the raw array contents: void spprintraw(const mxArray *mx) { mwSize n; mwIndex *ir, *jc; ...

14 years ago | 0

Answered
Printing Sparse Matrix in mex function in CCS format
I'm not sure what your real question is. Do you just want to print a sparse matrix from within a mex function? If so, you can us...

14 years ago | 0

| accepted

Answered
Matrix multiplication (best computational approach)
If you are simply after speed, the fastest approach will be a mex routine to do the calculations inline (i.e., explicitly withou...

14 years ago | 1

Answered
Mex file with OpenMP - Unexpected behavior
One thing for sure is you need to make th_id private (but that is just a printing issue that would not affect the total number o...

14 years ago | 0

Answered
how to delete NaN from a column of data
For your particular example: mean(data(~isnan(data))) For general nan handling, you might take a look at the FEX submiss...

14 years ago | 1

Answered
Finding eigenvectors of a matrix when all eigenvalues are known
Sounds like you are simply looking for the null space of M: Vset = null(M);

14 years ago | 0

| accepted

Answered
Mex dll and c file in Win7 64bit (Matlab 2010b)
I don't have a 64-bit system to test with, but the following does produce results on a 32-bit system. I have no idea if they are...

14 years ago | 1

Answered
Mex dll and c file in Win7 64bit (Matlab 2010b)
As Walter has already pointed out, versions of MATLAB through R2006b had the BLAS and LAPACK routines in one library, the libmwl...

14 years ago | 2

| accepted

Answered
How can I save an array in matlab to binary format as big endian data?
See the fwrite function: <http://www.mathworks.com/help/techdoc/ref/fwrite.html> And pay attention to the machineformat ar...

14 years ago | 1

| accepted

Answered
Count the number of non-zero elements of a column/row of a 2D-Matrix?
sum(X(row_number,:)~=0)

14 years ago | 6

| accepted

Answered
error using ==> times
You can do this: m = int32(1:3); n = m .* 2; % integer class times scalar double You can't do this: m = int32(...

14 years ago | 1

| accepted

Answered
Matlab engine in Fortran code (gfortran problem)
In Fortran you should never pass literal constant arguments to the API functions since they can vary in size among different pla...

14 years ago | 0

Answered
array
The nomenclature typically is: Scalars are 1x1 Vectors are 1xN or Nx1 Matrices are MxN Arrays are typically 3D or mo...

14 years ago | 0

| accepted

Answered
MEX - multiple export functions
To have your variables retain values from call to call, put them at the highest level of your code (i.e., outside any function s...

14 years ago | 1

| accepted

Answered
Matrix Max Sum
It was an interesting question, so I did a mex implementation. Uses a brute force indexing scheme with rejection (i.e., goes thr...

14 years ago | 0

Answered
Matlab version 2008b not recognizing Microsoft Visual Studio 2010 C++ compiler
You might be able to find some mex setup files in the FEX to help you. E.g., <http://www.mathworks.com/matlabcentral/fileexch...

14 years ago | 0

Load more