Answered
'new' in MEX file causes crash
You don't show enough code. E.g., these lines: getMatrixSize(prhs[0], rows, cols, "rhs0"); getMatrixSize(prhs[1], rows...

10 years ago | 0

Answered
R2012b convert HEX to binary and extract individual bits
Is this all you are trying to do? bits01_05 = bin2dec(BinaryNumber(1:5)); bits06_06 = bin2dec(BinaryNumber(6:6)); bit...

10 years ago | 0

| accepted

Answered
Get rid of unwanted output
You overwrite your input variable i with your for loop index i, which always goes up to 9. So do this instead: function out...

10 years ago | 0

| accepted

Answered
what does it mean wcode=w64(1,:);
It means that at that point in the code, there is no variable in the current workspace with the name w64.

10 years ago | 0

Answered
Verify my For Loops
The reason you are getting all 7's in your answer is because i+j is always 7, so you are assigning 7 to each element. And the i...

10 years ago | 2

| accepted

Answered
How can I use a vector value as a row index to modify an element?
Y = X; m = (1:size(X,1))'; % Generic row index vector g = bsxfun(@lt,m,V); % Logical indexes of the 0's Y(g) = 0; ...

10 years ago | 0

Answered
Specify compiler options for mex command
Maybe try some variant of the following: filename = your source code file name compiler_option = '/GL /fp:fast'; mex(...

10 years ago | 1

| accepted

Answered
Deleting Rows of a Matrix HELP
When you delete rows in a for loop, the indexing changes so the for loop indexing is no longer valid. Instead of using a for loo...

10 years ago | 0

| accepted

Answered
-3 + 5j in polar form
You could use the following: Z = -3 + 5j; R = abs(Z); theta = angle(Z); http://www.mathworks.com/help/matlab/ref/a...

10 years ago | 0

Answered
In an assignment A(I) = B, the number of elements in B and I must be the same.
t is a vector, so the expressions involving t that you have written will be vectors. You can't stuff a vector into a single elem...

10 years ago | 0

| accepted

Answered
Function of a function\
x = a\b; doc mldivide http://www.mathworks.com/help/matlab/ref/mldivide.html?searchHighlight=mldivide

10 years ago | 0

| accepted

Answered
result of ismember is wrong in my code correct in command window
I suspect this is just floating point issues. Reading from a file may read in all of the precision of the numbers (i.e., precis...

10 years ago | 0

| accepted

Answered
'Not equal too' statement not working
Another method using the function isequal, which is useful for arrays: if ~isequal(UserResponse,RequiredCoordinat...

10 years ago | 0

Answered
Matrix Transfer of elements
Did you mean to assign the entire row? E.g., this? path(i,:)=SearchStart; Just guessing here since SearchStart is a 1x2 m...

10 years ago | 0

Answered
How to exit a for loop if the conditions within it are already met?
Sounds like you have two conditions, your relative error calculation and your guess being close enough. If you want to forgo the...

10 years ago | 0

Answered
How can I break from an inner loop but still continue the outer loop?
One way is to use an auxiliary variable. E.g., for t=1:1:473; breakinner = false; for Lfn=1.0005:0.0005:5; ...

10 years ago | 4

Answered
How to store a vector under a for loop
theta(delta) = r1*sin(delta)*u; % <-- Added the (delta) indexing You will also need to change some of your matrix operators...

10 years ago | 0

| accepted

Answered
I want to create a nxn matrix with all 0s and n randomly placed 1s
n = whatever; x = zeros(n); x(randperm(n*n,n)) = 1;

10 years ago | 0

| accepted

Answered
cell of matrixes to cell of array
newC = cell(size(C)); for k=1:numel(C) M = C{k}'; newC{k} = M(:); end

10 years ago | 0

Answered
multiplying each non zero element of a sparse matrix by a certain number
W = S; G = logical(S); W(G) = W(G) .* P(:); Note: This preserves the sparse attribute of S. I.e., if S is sparse, th...

10 years ago | 3

Answered
Make this matrix multiplication more efficient
a = (B(1:n,:)*(A*b)).^2; You dimensions for B look a little strange to me, since your calculations do not use all of the ro...

10 years ago | 0

| accepted

Answered
Compensating Accelerometer readings from gravity i.e., finding out the direction of movement
First, there are too many unknowns. E.g., what are the coordinate systems of the quaternions (ECI to BODY, or what)? Scalar firs...

10 years ago | 0

Answered
Matrix does not compile
Looks like you have unbalanced parentheses. E.g., this would fix that problem: if iris_data{1,1} < mean(iris_data{1,1}) ...

10 years ago | 0

| accepted

Answered
Compare all elements in a matrix with elements in array
See if this helps do what you want: doc ismember

10 years ago | 0

Answered
Save figure in Matlab without borders
You might take a look at this FEX submission by Yair Altman: http://www.mathworks.com/matlabcentral/fileexchange/23629-export...

10 years ago | 3

| accepted

Answered
Does the RAM cleaning by a software (e.g. Advanced SystemCare 8) during the code running affect the calculation?
I would strongly suspect that this only cleans RAM that is not currently in use by another process (e.g., MATLAB). Unless you se...

10 years ago | 0

Answered
matlab engine giving wrong result when called in a function in Cpp file
These lines: int call_matlab_processing(double double_array[], int size_double_array,double * sorted, double * indices_cpp)...

10 years ago | 0

| accepted

Answered
can we use matlab engine from a inside a function in C++
You have a fundamental flaw in your code. You free the memory behind the pointers that you use downstream in your code. E.g., ...

10 years ago | 0

| accepted

Answered
Problem With K2 Algoritm
The message you are getting indicates that MATLAB can't *find* the function. Check your path to see that this function is in a d...

10 years ago | 0

| accepted

Load more