Respondida
Why is mxGetPi giving an Access Violation?
Some comments on your use of pointers and memory allocation: Mx_in = mxMalloc(sizeof(double) * 100*volume); <-- Delete...

casi 10 años hace | 0

| aceptada

Respondida
Does the "unique" function work with 64 bit integers?
Maybe use something similar to this as a workaround: y = x(logical([1;diff(sort(x))]));

casi 10 años hace | 0

| aceptada

Respondida
How to increase speed when taking the max from multidimensional array with -inf?
So, your examples are not the same size for one: N=ones(1,3,2); % <-- Not the same size as your inf example S...

casi 10 años hace | 0

Respondida
After using triu, how do I exclude the 0s in the vector?
M = A(triu(true(size(A)),1));

casi 10 años hace | 1

| aceptada

Respondida
Bug in dcm2quat function
My advice is to put in code to force the continuity that you want. That way you don't have to worry about some edge case that is...

casi 10 años hace | 1

Respondida
Generate poisson random number with a mean and standard deviation
See this: https://en.wikipedia.org/wiki/Poisson_distribution And this: http://www.mathworks.com/help/stats/poisson-dist...

casi 10 años hace | 2

| aceptada

Respondida
How do I shuffle a set of matrix to find the difference with another matrix?
A = whatever B = whatever m = 1000; % Number of trials n = numel(A); C = zeros(1,n); for k=1:m C = C + ...

casi 10 años hace | 0

| aceptada

Respondida
mex: valid c code crashes Matlab. (integer pointer)
You have a misunderstanding of pointers. This code: int *x = 1; *x = 14; Does the following: The first line declares...

casi 10 años hace | 0

| aceptada

Respondida
Euler integration for n dimensional system
Looks like you are assigning a vector to a scalar spot with this line: d(fz,1)=y; Try this instead: d(1:fz,1)=y; ...

casi 10 años hace | 0

Respondida
if a=[1,2,3,4] how can i get b=[ (1+2),(1+3),(1+4),(2+3),(2+4),(3+4) ] using for loops,Thanks
The limits on your first for-loop are not correct. In particular, length(a-1) is not the same as length(a)-1. And the limits o...

casi 10 años hace | 1

| aceptada

Respondida
Prime number list checker
Your code for resetting "counter" is inside an if-test. You need to move it so that it always executes. E.g., %#Want to te...

casi 10 años hace | 0

| aceptada

Respondida
Replace a Fraction of numerical Values with NaN excluding already existing NaN in the Matrix
Does this do what you want? Sets fraction of current non-NaN values to NaN: x = your matrix frac = 0.20; % Fraction of...

casi 10 años hace | 0

| aceptada

Respondida
Can I Always Change the Order of Operands of Logical Operators?
(Semantics, == and >= and <= are "relational" operators, not "logical" operators. E.g. & and | are "logical" operators.) For ...

casi 10 años hace | 0

Respondida
Rewriting a vector addition and multiplication.
D = bsxfun(@plus,sum(A.^2, 2),sum(B.^2, 2)') - 2.*(A*B');

casi 10 años hace | 0

Respondida
Assuring mex compatibility on different systems
There is *NO* assured compatibility of compiled mex code across different versions, operating systems, or platforms. The only a...

alrededor de 10 años hace | 0

| aceptada

Respondida
Can't generate plots of orbit using RK4
Try moving your f code outside of your function code. E.g., : figure() plot(xvar,yvar) end ...

alrededor de 10 años hace | 1

Respondida
how to replace char in array with a double
You made a cell array with this line: letters = cellstr(Roman')' That is why you are getting the conversion error. Make ...

alrededor de 10 años hace | 0

| aceptada

Respondida
Remove cell that contains strings of another cell array
You are changing the size of a in the loop with this line: a(k) = []; So subsequent iteration indexes that depend on ...

alrededor de 10 años hace | 2

| aceptada

Respondida
How to find mean of a vector including only a specific range of elements
vector = whatever; min_value = whatever; % 15 in your example max_value = whatever; % 25 in your example x = vector >...

alrededor de 10 años hace | 1

| aceptada

Respondida
How to get a subarray from a matrix
Switch your row and column indexing. E.g. M = N(1:n,end-n+1:end);

alrededor de 10 años hace | 4

Respondida
How can I convert the result grid from pol2cart into a uniform Cartesian grid
Does this do what you want: x = [-10:0.1:10]; [X,Y] = meshgrid(x); [PHI,RHO] = cart2pol(X,Y); Z = F(RHO,PHI); N...

alrededor de 10 años hace | 0

Respondida
how to convert Decimal degree to degree minutes decimal?
x = your data d = fix(x); f = x - d; result = 100*d + 60*f;

alrededor de 10 años hace | 1

| aceptada

Respondida
How to fix this error
Use element-wise multiply operator .* instead of * which is matrix multiply: x1= ((.25*pi^2)*(a+b).*((b-a).^2)); % <-- chan...

alrededor de 10 años hace | 2

| aceptada

Respondida
Quick way to find element by element difference betwen two vectors
mat = abs(bsxfun(@minus,vec2(:).',vec1(:)));

alrededor de 10 años hace | 1

| aceptada

Respondida
Symbolic 4D array
Not sure why sum(V,4) doesn't work, but reducing it to 2D with some reshapes seems to work: z = size(V); x = reshape(sum...

alrededor de 10 años hace | 0

Respondida
Vectorization of a specific matrix product
You could replace the for-loop by this: T = reshape(sum(bsxfun(@times,U,reshape(S,1,k,m)),2),n,m); But, I don't know wha...

alrededor de 10 años hace | 0

Respondida
Attempted to access x(5); index out of bounds because numel(x)=4.
The error is caused by ii iterating from 1 to 4, but you use ii+1 (=5 at last iteration) as an index into the x and y vectors wh...

alrededor de 10 años hace | 0

Respondida
Fastest way to cycle through a structure for a number
result = find([structure.val]==value); E.g., >> structure(1).val = 50; >> structure(2).val = 47; >> structure(3)...

alrededor de 10 años hace | 0

| aceptada

Respondida
Parallel Processing An Array/Array Appending
Can you save up all of the arrayToAdd stuff in a cell array and then cat all the results at once at the end to minimize the data...

alrededor de 10 años hace | 0

Respondida
how to put output of a function in diagonal of matrix
If y is a vector, then simply y = diag(y); If y is a matrix and you are trying to pick off the diagonal, then e.g., ...

alrededor de 10 años hace | 0

| aceptada

Cargar más