Answered
My for loop isn't working
Because you are constantly overwriting the value assigned to Co_By(img_line_B,2) with a new value because all of this is inside ...

9 years ago | 1

Answered
Exponential Function of Quaternions - quatexp -- error using scalar quaternions?
This is a bug in the quatexp function. E.g., >> q = [2 0 0 0;2 2*eps 0 0] q = 2.0000 0 0 ...

9 years ago | 1

Answered
Is it possible to declare the matrix is symmetric in advance before multiplication?
No you cannot declare this explicitly. However, in some cases MATLAB will detect that there is a symmetric multiply and call sy...

9 years ago | 1

| accepted

Answered
How to define an array with multiple columns for each parameter in a for loop?
At each iteration, the array sub-section indexing would be: array(:,n*20-19:n*20)

9 years ago | 0

| accepted

Answered
How to change sign in a cell?
respPreStore = cellfun(@uminus,respPreStore,'uni',false);

9 years ago | 0

| accepted

Answered
How can I store function_handle objects in MEX code?
Not sure I follow everything that is going on with your code, but here are my observations: self.setMessageHand...

9 years ago | 2

| accepted

Answered
"nchoosek" function for a matrix whose all elements are 0 or 1
E.g., using a loop: f = find(A); n = numel(f); result = repmat(A,n,1); for k=1:n result(k,f(k)) = 0; end...

9 years ago | 1

| accepted

Answered
Error using mex (line 206) Unable to complete successfully.
You need to visit the link shown above, and install one of the supported compilers that is listed there.

9 years ago | 0

Answered
Whats wrong in those equations?
Use element-wise operators (beginning with a dot) instead of matrix operators. E.g., y1=(0.02049/0.4)*x; y2=(0.59*60./(1...

9 years ago | 0

| accepted

Answered
a mex file in matlab program
To compile the mex routine, first place it in a working directory on the MATLAB path. Then make that your default directory and ...

9 years ago | 0

| accepted

Answered
how can i complement a DNA matrix using a binary vector?
Not quite sure I fully understand, but maybe something like this? mask = mod(X,1) > 0.5; % logical indexes of the characte...

9 years ago | 2

Answered
how can I do this in matlab?
E.g., replacing * with element-wise multiply .* and / with element-wise divide ./ you get (assuming I got your parentheses corre...

9 years ago | 0

| accepted

Answered
return to previous step
Do you mean something like this? % Step A while( true ) % Step B % Step C % Step D if( condi...

9 years ago | 2

| accepted

Answered
using sprintf for floating point numbers
You don't have a semi-colon after this line: optEnergyCostString=sprintf('%g',optEnergyCost) so this result gets display...

9 years ago | 0

| accepted

Answered
Problem with straightforward problem - Can you help?
Use parentheses to separate your || operations from your && operations as necessary. E.g., this line if A=='1' && B...

9 years ago | 0

Answered
How to invert 3D matrices?
Step 1) Get your 2D matrix pages into the 1st two dimensions. This makes each 2D page contiguous in memory and is somewhat of a...

9 years ago | 1

| accepted

Answered
matrix multiplication using bsxfun(@times,a,b)
Not sure if this is the operation you really want from your description: a = 6x7 matrix b = 7x3 matrix c = a * b; % ...

9 years ago | 0

| accepted

Answered
problem with loop while
You never change the value of freq_nat(2,2) inside your while loop, so if the while condition is true at the start of the loop, ...

9 years ago | 0

Answered
Subscripting into an mxArray is not supported for code generation - I think it's the colon that's the issue
What happens if you use explicit indexes? V(1:n,1) = (1/beta)*w;

9 years ago | 0

Answered
Why two equal numbers are not equal?
Already answered by others, but here is a detailed decimal conversion of what is going on with your particular example: >> ...

9 years ago | 1

Answered
How can I extract the numbers which make up a specific number and insert them into an array?
If the number is an integer, e.g., x = your number result = num2str(x) - '0';

9 years ago | 1

| accepted

Answered
How to convert from a for loop to a while loop
Your loop doesn't work because the "continue" statement skips over the Index=Index+1 statement. You need to rewrite things _with...

9 years ago | 0

| accepted

Answered
how i can use ez plot with sin(x)/(1+x^2)
E.g., using default range -2pi to 2pi: fun = @(x) sin(x)./(1+x.^2) ezplot(fun)

9 years ago | 0

Answered
Get a subset of a structure array in mex
Here is some sample code to create a subset of a struct array inside a mex routine. One key point is that there are no official ...

9 years ago | 1

Answered
anybody can help me please..... how i can write this with plot ? x=0:1:5; y=-5x^3+3x^2-5;
Vectorize the operations using element-wise operations. E.g., x = 0:1:5; y = -5*x.^3 + 3*x.^2 - 5; % <-- Note the .^ in...

9 years ago | 0

Answered
combination of two matrices
A = 160 x 12 matrix B = 160 x 12 matrix Ar = reshape(A',40*12,[]); Br = reshape(B',40*12,[]); result = reshape([Ar...

9 years ago | 1

| accepted

Answered
I need an elegant and fast way to get elements by single index in matrix
m = size(A,1); V = A((1:m)'+m*(I-1));

9 years ago | 1

Answered
How can i flip specific bit of an binary array.
E.g., the bit in the (2,3) position: a(2,3) = ~a(2,3);

9 years ago | 1

| accepted

Answered
I am trying to sort three numbers without using inbuilt functions.What is wrong with the function?
Two of your branches do not set all three output variables. E.g., if p(1)<=p(2) if p(1)<=p(3) small...

9 years ago | 0

| accepted

Answered
Definite Integrals With Answer
For Part A, the instructor may want the answer in terms of x, not t. E.g. syms x disp(int(40-2*t,0,x)) % <-- Or disp(s...

9 years ago | 0

| accepted

Load more