Respondida
How to use GPU to define a large 3D matrix
For starters, put semi-colons at the end of the delta(etc) = etc lines so that intermediate stuff doesn't print to the screen. D...

casi 10 años hace | 0

| aceptada

Respondida
how to display in one variable the max of each one of two arrays?
c = [max(a) max(b)];

casi 10 años hace | 1

| aceptada

Respondida
why - if kk = num (where kk = 6.0000 and num = 6 ) gives me false
The number is close to, but not exactly 6. When a value is exactly 6, MATLAB will display the value without any trailing 0's aft...

casi 10 años hace | 2

| aceptada

Respondida
Conditional statements not catching
Looks like your code is intended to have arrays as inputs. Because of this, *none* of your if-else-etc checking is going to wor...

casi 10 años hace | 0

| aceptada

Respondida
why zero to the power of zero is not NaN?
Having 0^0 = 1 is a choice MATLAB made and is in agreement with many authors. But this can either be OK or not OK for your appli...

casi 10 años hace | 1

Respondida
Multiply slices of a 4D array with vectors without nested loops? Is there a function comparable to pagefun for the CPU?
Some FEX options to consider (some of them involve mex routines): http://www.mathworks.com/matlabcentral/fileexchange/8773-mu...

casi 10 años hace | 0

| aceptada

Respondida
I want to use a function that is 1 at x=0 and 0 otherwise.I defined a new function impulse ,but it gives an error not enough input arguments.please help me.
Is this code in a file named impulse.m? And are you calling it as follows? result = impulse(some_input);

casi 10 años hace | 0

Respondida
Can I have a code that detects # of element transitions and return a matrix that has only rows of minimum element transitions?
Assuming you compare a row to the previous row and allow at most one element to change, you can use the results of diff(A), coun...

casi 10 años hace | 0

Respondida
Could someone explain why the below code shows an error like "FUNCTION keyword use is invalid"? I have attached the code below.
My guess is this is all one script file. You cannot define functions like that in a script file. So split this code into two fi...

casi 10 años hace | 0

Respondida
Matrix A & B need to be merged, Can I delete a complete raw if one appears in both matrices and same column position?
This was already answered in your other post, but I will repeat it here. k = ~any(bsxfun(@and,A,B),2); % identify rows wher...

casi 10 años hace | 1

| aceptada

Respondida
how to rotated a cube 30 deg counterclockwise around the axis that passes through v1 and v8
You can do the following steps: 1) Use v1 and v8 to form a unit rotation axis x 2) Use x and your desired rotation angle...

casi 10 años hace | 0

Respondida
what does this command: "@(x) Function" means in matlab?
That's a function handle. See this link: http://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html?se...

casi 10 años hace | 15

| aceptada

Respondida
how can I generate a code based on specific value selection in a matrix?
Here is one way as long as x is not too large. This technique will use too much memory if x is too large. b = dec2bin(0:2^n...

casi 10 años hace | 2

| aceptada

Respondida
Understanding the syntax meaning behind (:,)
The colon : as a subscript simply means "all of the values" for this subscript. So e.g. c(:,j) is all the rows of the j'th colu...

casi 10 años hace | 0

| aceptada

Respondida
displaying all values from a loop
Is this what you want: con = zeros(size(od)); for n=1:2:11 con(:,n:n+1) = od(:,n:n+1) * E'; end

casi 10 años hace | 0

| aceptada

Respondida
Help please solve 3nd Order Differential Equation using ODE45
Follow the 2nd Order example given in the doc (the one under "van der Pol equation"): http://www.mathworks.com/help/matlab/re...

casi 10 años hace | 1

| aceptada

Respondida
Vector search in a loop?
x = find(d==41); d(x) = z(x);

casi 10 años hace | 0

Respondida
How would I input the reverse of a natural log code?
result = exp(x) + 5 - exp(1) ./ y; Or maybe you intended something like this: result = exp(x + 5) - exp(1 ./ y);

casi 10 años hace | 0

Respondida
Write a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A
Ask yourself, "what does it mean to be in the lower right triangle" in terms of i and j? I.e., what test could you make on i an...

casi 10 años hace | 1

| aceptada

Respondida
Continious subtraction of a elements in an array
result = diff(A);

casi 10 años hace | 0

Respondida
Simple column vector - random number question.
You need to apply the floor() function to rand to get integer results, and your range multiplier isn't quite correct for the ran...

casi 10 años hace | 0

| aceptada

Respondida
When i run the script without the fprintf line i get the right answer. however when i apply the fprintf line i get the error "index exceeds matrix dimensions." how do i fix this? (my functions are in different .m files obviously)
Works for me: >> TriangleArea_Test The area for Test Case 1 is: 1.00 Try this: which fprintf Maybe you have a...

casi 10 años hace | 1

| aceptada

Respondida
How to efficiently update a matrix in Parallel?
In general, anytime you change elements in a sparse matrix to/from zero to non-zero, the *entire* matrix must be copied in memor...

casi 10 años hace | 0

Respondida
Operator ~= matrix dimensions doesn't match
To pick off the cell elements that are not equal to 'False start': pvt(~strcmp(pvt,'False start'))

casi 10 años hace | 0

Respondida
how to call fotran code in matlab 7
You can start by reading this documentation and working though the examples: http://www.mathworks.com/help/matlab/programming...

casi 10 años hace | 0

Respondida
replacing values in a vector with new value?
v = your vector n = v < 0; % the negative indexes (logical) p = v > 0; % the positive indexes (logical) v(n) = v(n) +...

casi 10 años hace | 0

Respondida
If A is a matrix, A(:) produces the columns in a vector. Is there a parallel function for rows?
First, I assume your example result is a typo, since A(:) will return the elements in column order, not row order. E.g., >>...

casi 10 años hace | 4

Respondida
Add zero rows to a matrix
Assuming all of the numbers in 1st column of A are increasing positive integers, e.g., result = zeros(max(A(:,1)),size(A,2)...

casi 10 años hace | 0

Respondida
Need help determining the order of the eigenvectors output from eig
You might look at this FEX submission by John D'Errico: http://www.mathworks.com/matlabcentral/fileexchange/22885-eigenshuffl...

casi 10 años hace | 0

Respondida
An empty do loop giving seg fault with OpenMP while mexing with fortran
Why is adjDist private? This means each thread will work with its own individual copy of adjDist. Is this what you are really ...

casi 10 años hace | 1

Cargar más