Respondida
mxCreateStructArray and mxCreateStructMatrix field name memory management
_"Are the field name character arrays copied before being stored internally?"_ Yes. Internally in the mxArray, the field name...

más de 9 años hace | 1

| aceptada

Respondida
matrix rows combination with all possibilities
E.g., one way to generate the possible combinations all in one 3D matrix, where each 2D plane (the first two dimensions) have th...

más de 9 años hace | 3

| aceptada

Respondida
difference between | and || in my function
The "|" operator is an element-wise operator, intended to be used on arrays element-by-element. The "||" operator is a short-ci...

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 1

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

más de 9 años hace | 1

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

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 2

| aceptada

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

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 2

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 2

| aceptada

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 0

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

más de 9 años hace | 1

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

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 1

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

más de 9 años hace | 0

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

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 1

Cargar más