Respondida
random numbers between a and b with specified mean and variance
1) a + b*rand() creates a value between a and a+b, not between a and b. 2) The values will have a uniform distribution with m...

casi 11 años hace | 2

| aceptada

Respondida
Why is MyCellArray{:} different than x = MyCellArray{:}?
MyCellArray{:} is a comma separated list. It is equivalent to typing the following: MyCellArray{1},MyCellArray{2},MyCellArr...

casi 11 años hace | 1

Respondida
Index exceeds matrix dimensions
This line: YC= YC(:,:,i); replaces the original multi-page YC with only *one* page of YC the first time through the loop...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 1

| aceptada

Respondida
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 ...

casi 11 años hace | 6

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

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

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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 ...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 1

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

alrededor de 11 años hace | 1

| aceptada

Respondida
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...

alrededor de 11 años hace | 0

Respondida
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...

alrededor de 11 años hace | 1

| aceptada

Respondida
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...

alrededor de 11 años hace | 1

Respondida
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 ...

alrededor de 11 años hace | 7

| aceptada

Respondida
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...

alrededor de 11 años hace | 0

Respondida
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...

alrededor de 11 años hace | 1

| aceptada

Respondida
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)...

alrededor de 11 años hace | 1

| aceptada

Respondida
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...

alrededor de 11 años hace | 0

| aceptada

Respondida
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 );

alrededor de 11 años hace | 0

| aceptada

Respondida
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...

alrededor de 11 años hace | 0

| aceptada

Respondida
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...

alrededor de 11 años hace | 0

Respondida
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...

alrededor de 11 años hace | 0

| aceptada

Respondida
?? 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...

alrededor de 11 años hace | 0

| aceptada

Cargar más