Answered
How to solve a system of ODE's by using Forward Euler method?
Replace y = zeros (1 , N ); % Initialize the Y vector . y (1) = y0 ; % Start y at the initial value . by y = zer...

8 years ago | 3

Answered
How to quit debug mode with shortcut when focus is on command window?
Inside the command window Shift+F5 should exit the debug mode already as default. So where did you set which kind of "shortcut"?...

8 years ago | 0

Answered
[2017b] how to solve "Error using matlab.graphics.chart.primitive.Line/horzcat Cannot convert double value -5.21739 to a handle".
Replace L3 = contour(X,Y,Z,10); by [~, L3] = contour(X,Y,Z,10); The first output of |contour| is the contour mat...

8 years ago | 2

| accepted

Answered
it gives me an error and i need help fixing this matrix
A = [1-L2*(rh(1)+(le-7))/(1e-7),L2*(rh(1)/(1e-7)+1),0,0,0,0,0,0,0,0,0 ... ^^^^ This is |le-7|, where |...

8 years ago | 1

Answered
No performance improvement with preallocating for object arrays
When I run the code for Signal = 7 The timings are (R2016b): 0.0017 % With pre-allocation 0.0134 % Without ...

8 years ago | 0

Answered
How to alter nearby values in a matrix with respect to a column?
A = rand(10, 10); % smaller test data A(:, 5) = 10 * rand(10, 1); A(:, 4) = (A(:, 5) + A(:, 4)) / 2; A(:, ...

8 years ago | 0

| accepted

Answered
How to separate cell rows in different cell??
Creating a bunch of variables dynamically is a bad idea, see <http://www.mathworks.com/matlabcentral/answers/304528-tutorial-why...

8 years ago | 0

Answered
Trouble with copyfile and rename
Param.folder1 = 'C:\Users...'; Param.folder2 = 'C:\Users...'; Files = dir(Param.folder1); for k = 1:length(F...

8 years ago | 0

Answered
How to shuffle an image diagonally?
This can be either a rotation or a mirroring. A rotation works either by |rot90| (see Guillaume's answer), or by: s = si...

8 years ago | 0

Answered
using sum() with a vector and increment
The colon operator ":" needs scalars as input. Then operation "vector:vector" is not defined. Unfortunately Matlab does not stop...

8 years ago | 0

| accepted

Answered
Help with "Matrix Dimensions Must Agree"
c is a 1x61 vector, and Z a 61x25 matrix. Then: c .* Z(i, :) tries to multiply a [1x61] and a [1x25] vector elementwise....

8 years ago | 1

| accepted

Answered
Does Matlab have a function which is similar with sizeof in C?
A cheap method would be: function S = sizeof(V) switch lower(V) case {'double', 'int64', 'uint64'} S = 8; case {'si...

8 years ago | 1

Answered
Using for loop to enter data with similar names
C = cell(1, 250); for k = 1:250 Filename = sprintf('C58501_line_ssF_%04d.txt',k); M = dlmread(Filename,' '...

8 years ago | 0

Answered
Can someone explain this type of error? please
Use the DependencyWalker to find the missing modules. See: <https://www.mathworks.com/matlabcentral/answers/92362-how-do-i-de...

8 years ago | 0

Answered
Help RE: Cannot find builtin function 'whos'
Something has destroyed your Matlab folder. Either important function have been deleted or destroyed. The solution is simple:...

8 years ago | 1

| accepted

Answered
How to handle discrete, non-periodic right-hand side of ODE in Matlab
Matlab's ODE solvers are designed to handle smooth functions only, see <http://www.mathworks.com/matlabcentral/answers/59582#ans...

8 years ago | 1

Answered
How to get a interval of time from user on which they want to plot?????
I'd prefer a GUI and a radio button group to select the time resolution manually. But I'm not sure, what you are asking for. Wha...

8 years ago | 0

Answered
How do you index an array inside an array of structures?
There is no direct method for "nested indexing". Your loop method is the best way, if you pre-allocate the output. This is a ...

8 years ago | 1

| accepted

Answered
How do you index an array inside an array of structures?
Some timings: for k = 5000:-1:1 % Backwards for implicit allocation s(k, 1).field = rand(1, 4); end ...

8 years ago | 3

Answered
Is there a way to optimize this code?
fout = fopen(binFileName, 'w'); if fout == -1 error('Cannot open file fro writing: %s', binFileName); end fwrite...

8 years ago | 0

Answered
How do you filter the results of the nchoosek(v,k) command?
Creating all combinations and removing the unwanted ones can be very expensive. The number of combinations grows rapidly with th...

8 years ago | 0

Answered
Repeating a task for each row without loop
Instead of avoiding the loop, start with a clean version with pre-allocation: x = [1, 1; 2, 2; 3, 3; 4, 7; 8, 8; 9, 9; 10, ...

8 years ago | 2

| accepted

Answered
GPS location bounding box
For the solution of the actual problem in Matlab it does not matter, if you process GPS coordinates of a ship, or the color or c...

8 years ago | 0

Answered
how to deploy sensor nodes randomly in a matrix 100x100
M = zeros(100, 100); Index = randperm(100*100, 100); % Linear index M(Index) = 1; Now you have 100 ones i...

8 years ago | 1

| accepted

Answered
Speed up lookup for matching a triplet of images
The iterative growing of arrays is extremely expensive. You should get a corresponding warning in the editor. So start with a pr...

8 years ago | 0

| accepted

Answered
How to generate integer random numbers of specific range including all numbers between the range?
n = 1; m = 5:10; Top = zeros(n, length(m)); for p = 1:n Top(p, :) = m(randperm(length(m))); end Or if the ...

8 years ago | 0

| accepted

Answered
could anyone help me to solve this issue.
The best idea would be to create the numbers in the correct format directly. I guess, that you used a method I have suggested to...

8 years ago | 0

Answered
how to linearly interpolate 2D matrix at a point (x,y)
Please post a copy of the complete error message and show us the inputs. This works fine: X = rand(4, 5); interp2(1:5...

8 years ago | 1

Answered
Trying to solve 4 coupled differential equations using ode45 and keep getting the error not enough input arguments
Please post the *complete* error message. This would reveal the failing line and is much better than letting the readers guess, ...

8 years ago | 0

| accepted

Load more