It is easier to solve a problem than to guess, what the problem is.

Questions about FileExchange submissions are welcome - get my address from the code. I do not answer mails concerning questions in the forum.

Answered

Multiply two terms at a set distance apart from each other in an array

The loop method: array = rand(1, 950); for i = 1:950 - 23 v = array(i+23) * array(i) end Stephen's vectorized approach ...

Multiply two terms at a set distance apart from each other in an array

The loop method: array = rand(1, 950); for i = 1:950 - 23 v = array(i+23) * array(i) end Stephen's vectorized approach ...

1 day ago | 0

Answered

How to deal with nested arrays where the columns and rows are in different dimensions?

I do not undestand why "Text Nr.1" appears multiple times. If this is a typo only: In = {your cell}; Out = cell(size(In)); f...

How to deal with nested arrays where the columns and rows are in different dimensions?

I do not undestand why "Text Nr.1" appears multiple times. If this is a typo only: In = {your cell}; Out = cell(size(In)); f...

1 day ago | 0

Answered

multiple default files for uigetfile

Under Windows this works: % Select multiple M-files: [File, Folder] = uigetfile('*.m', 'Choose files', '', 'Multiselect', 'on'...

multiple default files for uigetfile

Under Windows this works: % Select multiple M-files: [File, Folder] = uigetfile('*.m', 'Choose files', '', 'Multiselect', 'on'...

1 day ago | 0

Question

PARFOR in real applications

I've installed the Parallel Computing Toolbox for some experiments with my code. To my surprise none of the codes run faster wit...

1 day ago | 0 answers | 0

Answered

How can I efficiently add multiple arrays generated in a loop?

EXP is very expensive. This is the bottleneck of your code. Instead of applying it to matrices produced by MESHGRID, provide th...

How can I efficiently add multiple arrays generated in a loop?

EXP is very expensive. This is the bottleneck of your code. Instead of applying it to matrices produced by MESHGRID, provide th...

1 day ago | 0

Answered

Cumulative RMS in Matlab

Start with a mathematical definition of what you want to achieve. I guess you want this: x = rand(1, 100); % Your data % "Cu...

Cumulative RMS in Matlab

Start with a mathematical definition of what you want to achieve. I guess you want this: x = rand(1, 100); % Your data % "Cu...

1 day ago | 0

Answered

Same result but without ode45

ODE45 is a stepsize controlled Dormand Prince Integrator with local extrapolation. If you want to get exactly the same results,...

Same result but without ode45

ODE45 is a stepsize controlled Dormand Prince Integrator with local extrapolation. If you want to get exactly the same results,...

1 day ago | 0

Answered

How to change a sequence of integers?

Rule 1 is easy: x = [2 1 3 4 1 1 3 1 2 1 2 2 5 3 2]; m = strfind(x == 1, [false, true, false]); y = x; xm = x(...

How to change a sequence of integers?

Rule 1 is easy: x = [2 1 3 4 1 1 3 1 2 1 2 2 5 3 2]; m = strfind(x == 1, [false, true, false]); y = x; xm = x(...

1 day ago | 0

| accepted

Answered

How can I speedup this for loop and ismember?

Without having working inputs, we cannot run the function. Then it is not possible to improve the code reliably. Except for one ...

How can I speedup this for loop and ismember?

Without having working inputs, we cannot run the function. Then it is not possible to improve the code reliably. Except for one ...

1 day ago | 0

| accepted

Answered

How to take each 10 rows and put it in different group

X = rand(2000, 512); Y = reshape(X, 10, 200, 512); % perhaps: Y = reshape(X, 200, 10, 512)? % perhaps PERMUTE() such that the...

How to take each 10 rows and put it in different group

X = rand(2000, 512); Y = reshape(X, 10, 200, 512); % perhaps: Y = reshape(X, 200, 10, 512)? % perhaps PERMUTE() such that the...

1 day ago | 0

Answered

how to creat a Vectorization instead of a Double Loop

The most important part is "myfcn", which is not shown yet. Can it be called with an array as input? What does it reply? Only 0...

how to creat a Vectorization instead of a Double Loop

The most important part is "myfcn", which is not shown yet. Can it be called with an array as input? What does it reply? Only 0...

1 day ago | 0

Answered

transfer variables between functions?

Variables cannot be "transfered" between functions. You need to provide them as inputs and outputs. Combining GUI and the actua...

transfer variables between functions?

Variables cannot be "transfered" between functions. You need to provide them as inputs and outputs. Combining GUI and the actua...

2 days ago | 0

| accepted

Answered

Using Euler's method as ODE-solver in Matlab

How was the step size determined to be h=1/18? The author of the code wanted it to be 1/18. What does Euler's method in the w...

Using Euler's method as ODE-solver in Matlab

How was the step size determined to be h=1/18? The author of the code wanted it to be 1/18. What does Euler's method in the w...

2 days ago | 0

Answered

run the script without opening the figure, its possible?

There is no chance to guess, what your code does, if we cannot see it. Maybe there is no reason to display the images, maybe thi...

run the script without opening the figure, its possible?

There is no chance to guess, what your code does, if we cannot see it. Maybe there is no reason to display the images, maybe thi...

3 days ago | 0

Answered

For Loop through .wav files

See: FAQ: How to process a sequence of files Folder = 'insert your folder here'; % Sure that there is a sapce after your name?...

For Loop through .wav files

See: FAQ: How to process a sequence of files Folder = 'insert your folder here'; % Sure that there is a sapce after your name?...

3 days ago | 0

Answered

Share X and Y Axes for tiled layout plot

I'd solve this with subplot: https://www.mathworks.com/matlabcentral/fileexchange/20003-panel https://www.mathworks.com/matlab...

Share X and Y Axes for tiled layout plot

I'd solve this with subplot: https://www.mathworks.com/matlabcentral/fileexchange/20003-panel https://www.mathworks.com/matlab...

3 days ago | 0

Answered

Calling method in the GNU Scientific Library

You can create a C++-Mex function and call the library throught it. Unfortunately all inputs must be transposed, because Matlab ...

Calling method in the GNU Scientific Library

You can create a C++-Mex function and call the library throught it. Unfortunately all inputs must be transposed, because Matlab ...

3 days ago | 0

Answered

Homework Help: What did I do wrong?

The == operator compares its arguments elementwise. If they have a different number of elements, this fails, except it one is a ...

Homework Help: What did I do wrong?

The == operator compares its arguments elementwise. If they have a different number of elements, this fails, except it one is a ...

3 days ago | 0

Answered

Error in Y label

In the code you have: kylabel('Value of the function', 'fontize', 10) title('function 1', 'fontzie', 10) The error message sa...

Error in Y label

In the code you have: kylabel('Value of the function', 'fontize', 10) title('function 1', 'fontzie', 10) The error message sa...

3 days ago | 0

| accepted

Answered

Kunge Kutta 4 - Biological Application

I would like some help to understand if I did it right. I cannot estimate what you consider as right or not right. For a real...

Kunge Kutta 4 - Biological Application

I would like some help to understand if I did it right. I cannot estimate what you consider as right or not right. For a real...

3 days ago | 0

Answered

convert logical values to numeric values

a = [1 1 5 1 1] b = ischange(a) c = double(b) % Alternative: d = b + 0 % Addition with DOUBLE converts to double cell2...

convert logical values to numeric values

a = [1 1 5 1 1] b = ischange(a) c = double(b) % Alternative: d = b + 0 % Addition with DOUBLE converts to double cell2...

3 days ago | 0

| accepted

Answered

Averageing cell arrays in cell array

Using loops is the direct, clean and efficient way to access nested structs. cellfun works on cells only, not on nested structs...

Averageing cell arrays in cell array

Using loops is the direct, clean and efficient way to access nested structs. cellfun works on cells only, not on nested structs...

3 days ago | 0

| accepted

Answered

i have number i need save only integer without any point or 'e'

To get an integer value use round, floor or ceil. If you only want to hide the fractional part, which can contain small numbers...

i have number i need save only integer without any point or 'e'

To get an integer value use round, floor or ceil. If you only want to hide the fractional part, which can contain small numbers...

3 days ago | 0

Answered

How to change a char array into char row vectors?

ListA = ['BETA1'; ... 'BETA2']; ListAC = cellstr(ListA); Now you can run REGEXP on the cell string.

How to change a char array into char row vectors?

ListA = ['BETA1'; ... 'BETA2']; ListAC = cellstr(ListA); Now you can run REGEXP on the cell string.

3 days ago | 0

| accepted

Answered

FOR LOOP, add value to each row at a time

X = ones(1, 10); for n = 1:size(X, 2) Y = X; % Copy original value Y(n) = Y(n) + 1; ... do what you want to ...

FOR LOOP, add value to each row at a time

X = ones(1, 10); for n = 1:size(X, 2) Y = X; % Copy original value Y(n) = Y(n) + 1; ... do what you want to ...

3 days ago | 0

Answered

Looping over paths, more than one loop

I do not understand, what your inputs are exactly. But maybe this idea helps you: keepCode = cell(length(vectorOfNames), length...

Looping over paths, more than one loop

I do not understand, what your inputs are exactly. But maybe this idea helps you: keepCode = cell(length(vectorOfNames), length...

3 days ago | 0

| accepted

Answered

List the 10% highest values of a distribution

I guess that "x_UDP" is the same as "x". RMSF = load('rmsf.dat'); n = RMSF(:,1); %number of residue x = RMSF(:,2); %RMSF fo...

List the 10% highest values of a distribution

I guess that "x_UDP" is the same as "x". RMSF = load('rmsf.dat'); n = RMSF(:,1); %number of residue x = RMSF(:,2); %RMSF fo...

3 days ago | 1

Answered

Matlab code that does integration as well plot

Your code overwrites H in each iteration. So the final PLOT command outside the loop draws 1 point only. Because single points a...

Matlab code that does integration as well plot

Your code overwrites H in each iteration. So the final PLOT command outside the loop draws 1 point only. Because single points a...

3 days ago | 0

Answered

Error: Index exceeds the number of array elements (1).

You have defined months as a scalar: months(1) = month(dates(1)); Then months(g) must fail, if g>1. I cannot guess, what you ...

Error: Index exceeds the number of array elements (1).

You have defined months as a scalar: months(1) = month(dates(1)); Then months(g) must fail, if g>1. I cannot guess, what you ...

3 days ago | 0

| accepted

Answered

Problem with fscanf command in creating .txt file

filename1 = ['*new.txt'];%filename fid_t=fopen(filename1,'r') This cannot work: '*new.txt' is not a valid file nam...

Problem with fscanf command in creating .txt file

filename1 = ['*new.txt'];%filename fid_t=fopen(filename1,'r') This cannot work: '*new.txt' is not a valid file nam...

3 days ago | 0

| accepted