Answered
finding inverse of 3D matrix for speed
See this small size linear solver by Bruno Luong: http://www.mathworks.com/matlabcentral/fileexchange/27762-small-size-li...

11 years ago | 2

Answered
How do I append data to a MAT file from C++?
Why does it have to be a mat file? The simplest solution is to simply write the values in binary as you go, and then when you a...

11 years ago | 1

| accepted

Answered
Using mex: Cannot open include file: 'levmar.h': No such file or directory
levmar.h needs to be in the current directory. Try copying it there.

11 years ago | 0

Answered
problem in allocate and deallocating of memory in mexfunctio
The basic problem is you don't allocate enough memory for your doubles, since mxMalloc works in bytes. So do this instead: ...

11 years ago | 0

Answered
Index exceeds matrix dimensions Error
If "data" is 20x20, why are you indexing into it as a 3D array? E.g., data(:,col,i) What are the values of num_trials a...

11 years ago | 0

| accepted

Answered
How to improve/debug my matrix-column multiplier?
Your example is a standard matrix multiply, and your attempt is not too far off, so I will provide some corrections with some ot...

11 years ago | 0

| accepted

Answered
Parallel program required to be fixed for last couple of lines due to extensive time-consuming for saving variables in 3 by 3 matrix
E.g., using nD operations without parfor: cosabc = [cosa(:)'; cosb(:)'; cosc(:)']; cos0abc = [cosa0(:)'; cosb0(:)'; cosc...

11 years ago | 0

Answered
how do i remove this error? Function definitions are not permitted in this context.
You have your sub function "coord" defined inside your for loop. Move it outside your for loop.

11 years ago | 0

Answered
Deleting or selecting rows of a struct with a condition
The first part, assuming the .code fields are all 1 character: logfile_code = [logfile.code]; % Get all the codes g = lo...

11 years ago | 1

| accepted

Answered
mexfunction out of memory
You should get in the habit of using parentheses in all your macro "functions" to avoid nasty bugs in future code. E.g., these l...

11 years ago | 0

Answered
Plot binary matrix as dot
Another way: spy(sparse(x));

11 years ago | 4

| accepted

Answered
the question is : encrypt and decrypt message with length 64 char by using matlab ... this code is an example of encrypt decrypt message of 12 char
If you want to use the 5 x 5 code above, break the input into 25 character sets and process each set separately. If you have one...

11 years ago | 0

Answered
Why does adding time directly to datenum not add the anticipated amount of time?
I will advise using Guillaume's suggestion (datevec or datetime), but will point out that you are *not* losing a full 1 sec of a...

11 years ago | 0

Answered
How can I make matrix name and value in one matrix
You could use a cell array for this. E.g., Z = {A,'A';B,'B';C,'C';D,'D'};

11 years ago | 0

Answered
Search multiple matrices for values at common index positions
If you are just looking for when there are non-zero entries in the same index in all matrices, e.g., Result = a & d & e; ...

11 years ago | 0

| accepted

Answered
Executing code that's dynamically written to a file
What happens if you "clear" the script from memory before invoking it?

11 years ago | 0

| accepted

Answered
Why won't my "if then" statement keep my variable from dipping below zero?
You have a vector of values in xg_z, so you can use logical indexing to set those values that are less than 0 to 0. E.g., ...

11 years ago | 0

| accepted

Answered
Matlab efficiency - Pass by reference
I don't know if the in-place parsing is smart enough to deal with struct fields or not. E.g., see this Blog by Loren: http:/...

11 years ago | 1

Answered
Create an empty array of size (MxN) for xlswrite.
If an array has size 2592 x 2, then it is not empty. An empty array has at least one dimension that has size 0. If you mean cr...

11 years ago | 0

Answered
segfault when using "matmul" function in FORTRAN mex code
How large are your variables? I would hazard a guess that they are large, in the 10's or 100's MB or larger. One of the probl...

11 years ago | 0

| accepted

Answered
Simultaneously inverting many matrices
You might look at this FEX submission by Bruno Luong for solving 2x2 or 3x3 systems: http://www.mathworks.com/matlabcentral/f...

11 years ago | 2

Answered
Splitting a Matrix and saving results
You can use a reshape to help isolate your matrices. x = reshape(your_matrix,35,43,127); Then x(:,:,k) is the k'th indiv...

11 years ago | 0

Answered
Euler Method without using ODE solvers
What have you done so far? Can you code up the simple Euler's Method? E.g., if you started with this generic expression of Eule...

11 years ago | 1

Answered
Randperm generating the same sequence of permutation
Are you resetting the random number generator in between iterations?

11 years ago | 1

Answered
Logical indexing in maltab
If I understand your question, you are saying that y= X(X<Sal) returns a different result than y = X(X<0.005), even though Sal =...

11 years ago | 0

Answered
Is A./B different from B.\A?
I can't think of any reason why one would ever get different results for numeric types. I suppose there might be speed differen...

11 years ago | 0

| accepted

Answered
Counting elements of a cell
sum(~cellfun(@isempty,dataflows)) cellfun(@numel,dataflows)

11 years ago | 0

| accepted

Answered
segfault in matrix inversion using LAPACK in mex
Which BLAS and LAPACK are you linking with? For 64-bit MATLAB supplied libraries, I might have expected these routines to requi...

11 years ago | 0

| accepted

Answered
configuration of lapack and blas in matlab
MATLAB ships with BLAS and LAPACK libraries. E.g., on Windows for 64-bit Microsoft compilation, you can typically find them here...

11 years ago | 0

| accepted

Answered
how to randomly choose some values from specific variable
E.g., if you want only a subset of your vector: k = number of values you want; % Must be <= numel(a) p = randperm(numel(...

11 years ago | 1

Load more