Answered
Matrix multiplication-optimal speed and memory
Here is the mex routine. Comments should explain its intended use. You will need to install a C compiler as stated earlier. Then...

15 years ago | 0

| accepted

Answered
Matrix multiplication-optimal speed and memory
OK, so how about his approach (assumes W elements are non-negative): D' * W * D = D' * sqrt(W) * sqrt(W) * D ...

15 years ago | 0

Answered
Matrix multiplication-optimal speed and memory
I don't understand why the bsxfun-based proposed solutions listed in the link do not work for you. I would not expect this to ru...

15 years ago | 0

Answered
Interpreting a struct returned by engGetVariable
When you retrieve a variable with engGetVariable you are getting a deep copy of the variable from the engine into your program. ...

15 years ago | 0

Answered
problem of reading a double from .mat file in C
n = (int)(1000*x) is truncating the expression instead of rounding it, and your 0.2 is probably slightly less than 0.2 (since 0....

15 years ago | 1

| accepted

Answered
index returned array directly
No. This topic has been discussed many, many times on the newsgroup.

15 years ago | 2

| accepted

Answered
persistent mxArray untill matlab exits wtih Dll
Thanks for posting more of your code. Are you statically linking to a lib file? Otherwise I don't see in your posted code how yo...

15 years ago | 0

Answered
Multiply large matrix by scalar - speed issue
OK, here is a mex routine that does the exact calculation you have shown IN-PLACE, and it is bare bones without any argument che...

15 years ago | 1

| accepted

Answered
Multiply large matrix by scalar - speed issue
MATLABs matrix * scalar is pretty fast and multi-threaded to boot. Unless you have complex numbers involved I don't think you wi...

15 years ago | 0

Answered
Speed up a "logical matrix multiply"
Here is a mex approach. I am using the brute force matrix multiply algorithm without paying much attention to memory access patt...

15 years ago | 2

Answered
Overloaded matlab functions.
You can get this functionality for intrinsic types with a single function. e.g., function foo(a,b) if( iscell(a) ) % ...

15 years ago | 0

Answered
Location required for mex files?
My advice would be to put the mex files in the same directory as the same-named m-file. That way the mex file will always be cal...

15 years ago | 0

Answered
Cross product of two vectors(function)
OK. I will make a stronger statement this time. i+j+k is the *wrong* answer. You need to return a 3-vector, and i+j+k is *not* a...

15 years ago | 0

Answered
How to use object arrays in MEX
You can do this with a helper m-file: % CreateClassArray.m helper file for mxCreateClassArray mex function function clas...

15 years ago | 1

| accepted

Answered
Using a for loop to change matrix dimesnsions
Do not do it this way. Deleting rows (or columns) in a matrix is the same bad thing as growing a matrix in a loop. MATLAB will b...

15 years ago | 0

Answered
Compiling MEX files
In general, mex files are not guaranteed to be compatible from version to version, but they often do work. You will just have to...

15 years ago | 0

Answered
Reformat the date and time, and also show nanoseconds using mathlab
The "now" function is only good to about 0.015 sec accuracy. You should not use it for any timing that you need more precisely t...

15 years ago | 1

Answered
Mex, C++ compiler
See this link: <http://blogs.mathworks.com/desktop/2010/07/26/update-from-the-world-of-mex-visual-studio-2010-support/>

15 years ago | 0

Answered
What should take the longest time to run in matlab?
For your *specific* example the functions will take slightly longer. The functions need to be read in and parsed for one thing, ...

15 years ago | 0

Answered
How do I create a 2D sparse matrix?
You might take a look at this FEX submission by Matt J: <http://www.mathworks.com/matlabcentral/fileexchange/29832-n-dimensio...

15 years ago | 0

Submitted


typecast and typecastx C-mex functions
typecast and typecastx are mex functions that mimic the MATLAB typecast function with extensions

15 years ago | 1 download |

5.0 / 5
Thumbnail

Answered
Linking to FORTRAN subroutines
You might also be interested in this Fortran 95 interface package on the FEX: <http://www.mathworks.com/matlabcentral/fileexc...

15 years ago | 0

Answered
Traverse cell array of structures of ... in mex
C is 0-based indexing. You have this in your code: i = 1; Are you sure you have two elements in X? Or did you mean: ...

15 years ago | 0

Answered
Why are strings in a cellarray not interpreted as strings?
mystrings is a cell array, the elements of which are cells. The *contents* of the cells are strings. The ( ) syntax recovers the...

15 years ago | 1

Answered
Multiply then sum elements of two matrices
A bit of self-promotion: mtimesx(A(:),'T',B(:),'speedomp') You can find mtimesx here: <http://www.mathworks.com/matla...

15 years ago | 1

Answered
Help regarding "format long"
You may also find the num2strexact utility to be of some help in understanding this. e.g., >> num2strexact(4.196) ans = ...

15 years ago | 0

Answered
Representing a number as a matrix
For a non-negative integral value: >> x = 146 x = 146 >> num2str(x) - '0' ans = 1 4 ...

15 years ago | 1

| accepted

Answered
How do i select a variable for global use from an array?
A = D.A; But why not just use D.A?

15 years ago | 1

Submitted


MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support
Beats MATLAB 300% - 400% in some cases ... really!

15 years ago | 5 downloads |

4.6 / 5
Thumbnail

Answered
Converting a date string to day of year
Here is an outline of code to get Day Of Year: >> d = '12/25/1957' d = 12/25/1957 >> v = datevec(d) ...

15 years ago | 3

Load more