Respondida
Converting 1x1 matrix into 200x1 with same value?
myVector(1:200,1) = singleValue;

más de 11 años hace | 1

| aceptada

Respondida
error in c-compiler
Type the following at the command line. When asked if you want MATLAB to look for compilers, press Enter: mex -setup If ...

más de 11 años hace | 0

Respondida
Error using horzcat Dimensions of matrices being concatenated are not consistent. Please help.
Use the debugger to pause the code at the error. Then examine the dimensions of the variables involved and figure out what the p...

más de 11 años hace | 0

Respondida
How to eliminate rows with NaN elements?
rows = any(isnan(myMatrix),2); myMatrix(rows,:) = [];

más de 11 años hace | 3

| aceptada

Respondida
How to do counter in matlab?
I am still guessing here. Maybe this is what you want? (I am assuming M is square) load M.dat t = 600; q = zero...

más de 11 años hace | 0

Respondida
Editing a function to return a value that shows how many times a recursive function is called
See this link: http://www.mathworks.com/matlabcentral/answers/195865-fibonacci-program-makes-matlab-go-busy-forever You co...

más de 11 años hace | 0

Respondida
Choose certain matrix elements from a matrix
You could use logical indexing for this. E.g., z = r < R; % Logical result for 1's locations z = z(:); % Turn into colum...

más de 11 años hace | 0

Respondida
what does inner matrix dimensions must agree matlab error?
This error can often be fixed by replacing the * operator (matrix multiply) with the .* operator (element-wise multiply). Look a...

más de 11 años hace | 0

Respondida
narginchk and varargin in MATLAB
narginchk(7, 7) throws an error if the number of input arguments is less than 7 or greater than 7 (i.e., the number of input arg...

más de 11 años hace | 0

Respondida
Give me an hint
Hint: doc find

más de 11 años hace | 1

Respondida
Optimize/speed up a big and slow matrix operation with addition and bsxfun?
Assuming you have a C compiler available, here is a simple C mex routine to do the calculation. Could possibly be sped up even m...

más de 11 años hace | 0

| aceptada

Respondida
How to increase the precision in my output using structures
I would assume s(1).pixels is some type of integer class instead of double, so you are getting an integer result. Either convert...

más de 11 años hace | 0

Respondida
how to solve this question using two loops?
Big Hint: Suppose the grid is M x N. You've got (M+N) total moves to make, with M of them being "down" and N of them being "r...

más de 11 años hace | 0

| aceptada

Respondida
How to plot multiple functions on one graph>
plot3 with hold on should have worked. That being said, looks like the last three cases have vo typos to me, since vo is all 0's...

más de 11 años hace | 2

| aceptada

Respondida
load a file with 'dir'
You are getting the results of dir from a different directory than the current directory. I.e., you explicitly put the path in t...

más de 11 años hace | 0

| aceptada

Respondida
Derivative of a Function
If you have the Symbolic Toolbox: >> g = @(x) exp(x^2-2) g = @(x)exp(x^2-2) >> syms x >> diff(g(x)) ans...

más de 11 años hace | 0

| aceptada

Respondida
The plot for t and ssdot in the following code cannot be displayed as it shows a vector length mismatch. Please suggest how I can get around it...
Your loop is for i=1:n+1 So the last iteration increases the size of ssdot when this line is encountered: ssdot(1,i...

más de 11 años hace | 0

| aceptada

Respondida
how to concatinate two array values in one array
A3 = [A1 A2];

más de 11 años hace | 0

| aceptada

Respondida
How to determine the MATLAB version when compiling C/C++ mex files
After reconsidering the fact that I no longer have access to the many MATLAB versions that I used to (changed jobs), I realize t...

más de 11 años hace | 3

Respondida
Insert numbers of a matrix B in matrix A (only in odd indexes).
k = i + j; C = zeros(1,k); C(1:2:end) = A; C(2:2:end) = B;

más de 11 años hace | 1

| aceptada

Respondida
How to determine the MATLAB version when compiling C/C++ mex files
mxCreateUninitNumericMatrix has been in the libraries for many years as an exported function, at least as far back as R2006 or s...

más de 11 años hace | 2

Respondida
Attempted to access x_set(:,100); index out of bounds because size(x_set)=[7600,1] help
Typically one would remove entire rows or entire columns if you want to preserve the 2D matrix. By removing individual elements ...

más de 11 años hace | 1

Respondida
Most efficient way to add multiple sparse matrices in a loop in MATLAB
Unless you know in advance the pattern of the non-zero spots and can exploit that, then I think you are stuck. At every iteratio...

más de 11 años hace | 1

Respondida
How to optimize this matlab code?
I assume you are trying to vectorize this for speed purposes. In your current code, the x(:,:,k) expression copies data, and the...

más de 11 años hace | 2

Respondida
Find the inear indices of a specific value in a 3d matrix using the positions of a 2d matrix
Another way: find(bsxfun(@and,A==2,B==1))

más de 11 años hace | 2

Respondida
Error using * inner matrix dimensions must agree
Most likely i is not a scalar, hence the error. Try stopping on the error and then examining the dimensions to see what is going...

más de 11 años hace | 0

Respondida
I want Seperate Matrices for different values of n . (Im new to Matlab)
Don't do this! See these links for better solutions: http://www.mathworks.com/matlabcentral/answers/143-how-do-i-make-a-serie...

más de 11 años hace | 0

Respondida
Is it faster to use array size as an input or calculate size
For ease of use, typically the size would be generated inside the function to make sure there was no mismatch. For speed, this c...

más de 11 años hace | 1

Respondida
Exponential Function using Taylor series
1) You need to turn your factorial script into a function. However, note that MATLAB has a function called factorial already. So...

más de 11 años hace | 1

| aceptada

Respondida
second order differential equation using ode45 and an events option: (195/32) * D2y + 0.005*(Dy)^2 = 0
y at 5 seconds is *not* y(5). You need to examine the variable *t* to determine time, not y. So pass in t and base your event on...

más de 11 años hace | 1

| aceptada

Cargar más