Answered
Multiply each element of a vector with a matrix
Yet another method for completeness using an outer product formulation. May not be any faster than bsxfun et al: result = r...

14 years ago | 4

Answered
fortran 128 bit precision
Are you trying to create a mex routine from your Fortran code (e.g. using Intel ifort) that does the 128-bit floating point calc...

14 years ago | 0

Answered
Bug in max function?
Documented behavior. When combing double with lesser classes (single, uint8, int32, etc) the conversion is done to the lesser cl...

14 years ago | 1

| accepted

Answered
Matlab shuts down after executing a mex call
plhs[] is an array that MATLAB creates when you call the mex function to hold the return variables. But MATLAB doesn't create th...

14 years ago | 2

| accepted

Answered
Running the same matlab program in two matlab windows
I do this all the time and it works just fine. However, pay attention to Jason's warnings. I don't write out to any files and I ...

14 years ago | 3

Answered
MATLAB appcrash when I use mxFree in S-Function
I know nothing about S-functions, but to hazard a guess maybe you need to NULL out the array value after you manually free the m...

14 years ago | 0

Answered
Why your question is NOT "urgent" or an "emergency"!
Is there a way for TMW to make this post PERMANENTLY appear as the very first post? Or for TMW to scan all new posts for the wor...

14 years ago | 9

Answered
Passing C function pointers when working with Mex files?
You can put all of your variables that you want to retain values at the top level of your code (i.e., global ... outside of any ...

14 years ago | 1

| accepted

Answered
Trouble Calling lapack functions from mex files on 64 bit Windows
Why are you using an mxINT32_CLASS for creating mxPivot? Seems like this would only work if mwSignedIndex is a 32-bit integer on...

14 years ago | 0

| accepted

Answered
-largeArrayDims option in Visual Studio
I think you would have to look into the header files (mex.h, matrix.h, etc) to see what macro(s) are actually expected to be def...

14 years ago | 0

Answered
writing a hex number in the right format
UnitType is a string so use a string format %s instead of the hex format %x. Does your result always have to have exactly two he...

14 years ago | 0

| accepted

Answered
Pointer in a C mex sfunction
You don't show the definitions of Int_T, real_T, and InputRealPtrsType, so I am guessing a bit here. y is a pointer to a real...

14 years ago | 0

| accepted

Answered
What do you think of Cody, new service for MATLAB Central
My first experience with CODY: Tried the "sum integers from 1 to 2^n" problem. Example used only a scalar input, but I coded ...

14 years ago | 2

Solved


Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

14 years ago

Solved


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

14 years ago

Answered
direct access to the result of a function call
This question in various forms has been asked multiple times on this forum and on the newsgroup. The answer is no, you cannot do...

14 years ago | 1

| accepted

Answered
What is the most memory efficient way to return large arrays in a C structure from a Matlab C mex function?
You cannot mix native C/C++ memory (i.e., local stack variables or allocated variables with malloc & cousins) into an mxArray fo...

14 years ago | 2

| accepted

Answered
Creating a new variable in each iteration...
E.g., with the usual caveats about this typically being a bad idea: eval(['x_' num2str(count) ' = i^2']);

14 years ago | 2

| accepted

Answered
How to handle large matrices
Here is some m-code for what I *think* you want: m1 = size(pc_raw,1); m2 = size(fw_raw,1); k2 = 1; for k1=1:m1 ...

14 years ago | 1

Answered
Doing multiplication and division within a sum()?
Change the offending array class to double.

14 years ago | 1

| accepted

Answered
argmin of a vector
From the documentation for the min function: [C,I] = min(...) finds the indices of the minimum values of A, and returns them ...

14 years ago | 2

| accepted

Answered
Find a length of string/array without length function
I have no idea what the point of this question is, but do you mean something like this? try k = 1; while( tru...

14 years ago | 1

| accepted

Answered
empty sparse matrix with size greater than (100000,100000) needs overhead space
Sparse matrices in MATLAB always store an index vector that is the same size as the number of columns+1. So even for an empty sp...

14 years ago | 1

| accepted

Answered
[Linux 64 bit] MEX seg fault on simple FORTRAN file
The timestwo.f example only works for scalar inputs. How are you calling it? (Side Note: size is a Fortran intrinsic function na...

14 years ago | 0

Answered
Please Speed UP This Algoritm!!!
Another option you can try using some FEX submissions (slightly better at memory management than your original code): unini...

14 years ago | 0

Answered
merge date time
If X is your original M x 2 data: X(:,1)*1000000 + X(:,2)

14 years ago | 0

Answered
sum in matrix
y = cumsum(x);

14 years ago | 2

| accepted

Answered
how to load data to workspace through m-file
See this FEX submission by John D'Errico: <http://www.mathworks.com/matlabcentral/fileexchange/27106-putvar-uigetvar>

14 years ago | 0

| accepted

Answered
IEEE Arithematic
Limitations of floating point arithmetic, again. Particularly with matrix and vector operations, you are not guaranteed any part...

14 years ago | 0

| accepted

Answered
Computer Arithematic
The limitations of floating point arithmetic. IEEE double precision can't store your numbers exactly, so the closest number in t...

14 years ago | 0

| accepted

Load more