Answered
C-MEX codes face problem "MATLAB has attempted to use more stack space than is available"
The memory for plhs[0], plhs[1], and plhs[2] should be coming off of the heap, not the stack. So those variables should not be c...

11 years ago | 1

| accepted

Answered
Can I make use of OpenMP in my MATLAB MEX-files?
You left out one *extremely* important detail. The API functions that use the MATLAB Memory Manager are *not* thread-safe! That ...

11 years ago | 6

Answered
Adding compaq visual fortran to compiler list
Support for Compaq Visual Fortran was discontinued many years ago. At first they just dropped the setup files (one could still g...

11 years ago | 0

| accepted

Answered
Rounding Errors in Matlab
"Shouldn't I get the same rounding error at least?" No, you should not expect this in general. MATLAB uses BLAS library routi...

11 years ago | 0

Answered
How to convert for loop statement to matrix operation?
Assuming the matrix sizes are compatible, using logical indexing: temp( input_img == 0 ) = 0;

11 years ago | 0

| accepted

Answered
Do the calculation with 100 Digits and higher
Native IEEE double calculations in MATLAB are limited to about 15 decimal digits. For more than that, you can use vpa with the S...

11 years ago | 0

Answered
Datenum conversion problem?
First, is yy really a Julian day array, or is it a Day Of the Year (DOY) number array? There are quite a few websites etc out th...

11 years ago | 0

| accepted

Answered
how to creat periodic function
Mod the input x with 2*pi and then do your testing above to generate the output, making sure to cover all cases for x between 0 ...

11 years ago | 0

Answered
Is it possible for matlab to clear a mex function even when mexIsLocked is true?
Can you use the inmem function to verify that the mex routine actually got cleared even though it was locked? Do you have any c...

11 years ago | 0

Answered
Speed of Matrix-Multiplication (in Matlab, C, other PCs)
MATLAB uses a very fast and highly optimized BLAS library to do matrix multiplication. You are unlikely to find anything faster ...

11 years ago | 0

| accepted

Answered
Many small Eigenvalue Decompositions in parallel on GPU?
If you just need the eigenvalues, you might look at this FEX submission by Bruno Luong: http://www.mathworks.com/matlabcentra...

11 years ago | 1

Answered
Writing a function to find prime numbers
The basic problem is that you are mixing character variables (with the single quotes ' ') with logical variables (without single...

11 years ago | 0

| accepted

Answered
C-MEX file: I want to return an empty array, does anyone know how?
This will return an empty 0x0 matrix: #include "mex.h" void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArr...

11 years ago | 0

| accepted

Answered
How to filter a variable by removing NaN on matlab
You can skip the loops and just do this vectorized one-liner instead: data(isnan(data)) = 0; % Set all NaN elements to 0 us...

11 years ago | 1

| accepted

Answered
Deleting rows in a matrix
"Matrix B includes values which represent row numbers of matrix A that should be deleted" Assuming this is exactly what you w...

11 years ago | 0

Answered
Access value of Enumeration from C/C++ mex function
Old style obects (i.e., those using exclusively the @classname directory structure) were stored internally as structs, which mad...

11 years ago | 1

| accepted

Answered
What is the fastest way to perform x'Ay ?
I don't know that there is anything faster than what you have written. A matrix multiply followed by an inner product using BLAS...

11 years ago | 1

Answered
Error: "MATLAB cannot run this file because c:\~~~ shadows it. delete shadowing file and try again"
There is a pecking order of files to run when several files of the same base name are visible (i.e. in the current directory or ...

11 years ago | 7

| accepted

Answered
Save/Load an Object Array
To get your original variables to show up with the names they had originally (instead of field names in a struct), just use load...

11 years ago | 0

Answered
Homework Problem Week 5 Problem 1
Change this: else a > 2012 to this: else And change this: elseif a >= 1996 && a <= 1980 gen = X; to...

11 years ago | 1

| accepted

Answered
How to use one matrix to constrain another matrix of the same size?
If I understand your question correctly, then x = A < 0.01; % Logical indexing for those elements you want to keep B(~x)...

11 years ago | 1

| accepted

Answered
Search entire multi level cell array for matching string
Does this do what you want? mystring = whatever string you are trying to find MyCellArrays = [cellfun(@(x)x(:)',MyCellAr...

11 years ago | 0

| accepted

Answered
How to find a string within a matrix and output array index to variable
your_matrix = 1621 x 1 matrix containing values 1 - 4 site = some value 1 - 4 indexes = find( your_matrix == site );

11 years ago | 0

| accepted

Answered
How to load a variable from a loop name mat ?
Are you simply asking how to load a specific variable? E.g., variable_to_load = 'X'; for n=1:4 load(['nano',num2...

11 years ago | 0

| accepted

Answered
How to Combine Several Variables Into One Matrix?
The easiest way would be to read your variables into elements of a column vector cell array instead of reading them in as indivi...

11 years ago | 0

Answered
How can I fix the error when multiple two matrices?
Did you mean element-wise multiplication? If so, use the .* operator. E.g., a = your 100 x 1 vector b = your 100 x 1 vec...

11 years ago | 0

| accepted

Answered
?? Error using ==> times Matrix dimensions must agree.
Type the following at the command line: dbstop if error Then run your code. It will pause at the line with the error. Ex...

11 years ago | 0

| accepted

Answered
How to properly write an if-else-statement such that if the condition is met, then the values in x-vector will be stored in the vector; or else the values in the x-vector will not be deleted??
g = (x >= 1) & (x <= 2440); % Logical result of the elements you want to keep x(~g) = []; % Delete the others (or you could...

11 years ago | 1

| accepted

Answered
Random number gerator problem
hist(r, 1:limit); You inadvertently used randomness in your hist call, so MATLAB tried a recursive call with no arguments, ...

11 years ago | 0

| accepted

Answered
How can a MEX file give parameters to a C++ program?
In this line you are using an integer output format %i to print a floating point double value: mexPrintf("Value Read = %i\n...

11 years ago | 1

| accepted

Load more