12,395 total contributions since 2009

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

How do you remove duplicates of nested cells?

A loop appraoch: C = RomanticGestures; n = numel(C); remove = false(1, n); for i1 = 1:n for i2 = i1 + 1:n if ~...

How do you remove duplicates of nested cells?

A loop appraoch: C = RomanticGestures; n = numel(C); remove = false(1, n); for i1 = 1:n for i2 = i1 + 1:n if ~...

4 hours ago | 0

Answered

"not equal to" in MATLAB

Several possible ways: if 1 ~= 2 if not(1 == 2) if ~(1==2) if ne(1, 2) if ~eq(1, 2) if 1 - 2 % Implicitly eva...

"not equal to" in MATLAB

Several possible ways: if 1 ~= 2 if not(1 == 2) if ~(1==2) if ne(1, 2) if ~eq(1, 2) if 1 - 2 % Implicitly eva...

1 day ago | 2

Answered

Parameter in my ode

See Answers: Anonymous functions for parameters and https://www.mathworks.com/help/matlab/math/parameterizing-functions.html (y...

Parameter in my ode

See Answers: Anonymous functions for parameters and https://www.mathworks.com/help/matlab/math/parameterizing-functions.html (y...

1 day ago | 1

Answered

Gridlines when exporting .pdf in Word 2016

You can replace the grid my drawing the lines manually with the wanted color. Would this solve the problem? aAxesH = axes('Next...

Gridlines when exporting .pdf in Word 2016

You can replace the grid my drawing the lines manually with the wanted color. Would this solve the problem? aAxesH = axes('Next...

1 day ago | 0

Answered

How to generate random points within 3d pyramid

See: https://www.mathworks.com/matlabcentral/answers/327990-generate-random-coordinates-inside-a-convex-polytope https://www.m...

How to generate random points within 3d pyramid

See: https://www.mathworks.com/matlabcentral/answers/327990-generate-random-coordinates-inside-a-convex-polytope https://www.m...

3 days ago | 0

Answered

desactivation of the "MATLAB system error" dialog box ?

I'm running a long test also. The code displays some logging messages every few seconds. A second Matlab session takes a screens...

desactivation of the "MATLAB system error" dialog box ?

I'm running a long test also. The code displays some logging messages every few seconds. A second Matlab session takes a screens...

3 days ago | 0

Answered

How can I add a line to an imagec figure?

Maybe (see my comment above): line(t([3952, 3952]), altitude([1, end]))

How can I add a line to an imagec figure?

Maybe (see my comment above): line(t([3952, 3952]), altitude([1, end]))

3 days ago | 0

| accepted

Answered

How do I add an additional column to a cell array based on existing values in another column?

x = {'asd', 1; ... 'bsd', 0}; x(:, 3) = num2cell(1 - cell2mat(x(:, 2))) % or: Value = {0, 1}; x(:, 3) = Value(2 - ce...

How do I add an additional column to a cell array based on existing values in another column?

x = {'asd', 1; ... 'bsd', 0}; x(:, 3) = num2cell(1 - cell2mat(x(:, 2))) % or: Value = {0, 1}; x(:, 3) = Value(2 - ce...

4 days ago | 0

Answered

Strategies for reducing calculation time: Finding values in a large array

[uniqID, ~, index] = unique(RawData(:, 1)); avg = accumarray(index, RawData(:, 2), [], @mean); result = [uniqID, avg]; Do ...

Strategies for reducing calculation time: Finding values in a large array

[uniqID, ~, index] = unique(RawData(:, 1)); avg = accumarray(index, RawData(:, 2), [], @mean); result = [uniqID, avg]; Do ...

4 days ago | 0

| accepted

Answered

Rolling-window matrix with different intervals between columns.

vec = [1 2 3 4 5 6 7 8 9 10 11 12 13]; n = numel(vec); step = 3; width = 4; col1 = 1:step:n - width + 1; row1 ...

Rolling-window matrix with different intervals between columns.

vec = [1 2 3 4 5 6 7 8 9 10 11 12 13]; n = numel(vec); step = 3; width = 4; col1 = 1:step:n - width + 1; row1 ...

5 days ago | 0

Answered

Index exceeds number of array elements (181)

Use the debugger to examine the cause of the problems. Type this in the command window: dbstop if error Then run the code agai...

Index exceeds number of array elements (181)

Use the debugger to examine the cause of the problems. Type this in the command window: dbstop if error Then run the code agai...

5 days ago | 0

Answered

Mathematics of the bandpass function

The documentation explains: bandpass uses a minimum-order filter with a stopband attenuation of 60 dB and compensates for the d...

Mathematics of the bandpass function

The documentation explains: bandpass uses a minimum-order filter with a stopband attenuation of 60 dB and compensates for the d...

5 days ago | 0

Answered

Fast Elementwise Matrix-Multiplications

Of course times is implemented efficiently already and most likely it does use the MKL, but this is not documented and a reverse...

Fast Elementwise Matrix-Multiplications

Of course times is implemented efficiently already and most likely it does use the MKL, but this is not documented and a reverse...

5 days ago | 1

| accepted

Answered

a 2D into a 3D Array

Prefer Shunichi Kusano's solution. But for completeness: ini = 1; fin = 9; a = zeros(9, 2049, 3867); m = size(PICT, 1); ...

a 2D into a 3D Array

Prefer Shunichi Kusano's solution. But for completeness: ini = 1; fin = 9; a = zeros(9, 2049, 3867); m = size(PICT, 1); ...

5 days ago | 1

Answered

Difficulty to get the results by using repmat function

I'm not sure, what you are asking for. With some guessing: a1 = eomday(d(:,1),d(:,2)); index = repelem((1:size(b, 1)).', a1...

Difficulty to get the results by using repmat function

I'm not sure, what you are asking for. With some guessing: a1 = eomday(d(:,1),d(:,2)); index = repelem((1:size(b, 1)).', a1...

5 days ago | 0

| accepted

Answered

How to use matlab to call c + function file and draw？

What about converting the code to Matlab? This is more or less trivial: function cdValue = yourFcn(Kc, Re) cdValue=0.0; % Do ...

How to use matlab to call c + function file and draw？

What about converting the code to Matlab? This is more or less trivial: function cdValue = yourFcn(Kc, Re) cdValue=0.0; % Do ...

5 days ago | 0

| accepted

Answered

Variable is in a function file, how do I use a loop to change the value of this variable?

Do not redefine the important Matlab function cd as a variable, because this can cause serious troubles during debugging. [T,Z]...

Variable is in a function file, how do I use a loop to change the value of this variable?

Do not redefine the important Matlab function cd as a variable, because this can cause serious troubles during debugging. [T,Z]...

5 days ago | 1

Answered

Matlab Novice here - struggling to truncate a column array

cellfun(@(x) x(18:19), C, 'UniformOutput', false)

Matlab Novice here - struggling to truncate a column array

cellfun(@(x) x(18:19), C, 'UniformOutput', false)

5 days ago | 0

Answered

Data Tips -- Add Row Error

Did you read the example https://www.mathworks.com/help/matlab/creating_plots/create-custom-data-tips.html and https://www.mathw...

Data Tips -- Add Row Error

Did you read the example https://www.mathworks.com/help/matlab/creating_plots/create-custom-data-tips.html and https://www.mathw...

5 days ago | 0

Answered

create vector from 21 individual values from for-loop

K = zeros(1, 21); % Pre-allocation for ii = 1:21 K(ii) = rand; % Insert your calculations here end If you post your co...

create vector from 21 individual values from for-loop

K = zeros(1, 21); % Pre-allocation for ii = 1:21 K(ii) = rand; % Insert your calculations here end If you post your co...

5 days ago | 0

Answered

Errors after removal of appdata folder

The question is very vague. "unique() function isn't working properly" doies not contain any detail which would allow to underst...

Errors after removal of appdata folder

The question is very vague. "unique() function isn't working properly" doies not contain any detail which would allow to underst...

5 days ago | 0

| accepted

Answered

Comparing input character and a String

Of course a(1) and a1 are two completely different things. It is not clear, what the contents of b1 is, but maybe you want: b1 ...

Comparing input character and a String

Of course a(1) and a1 are two completely different things. It is not clear, what the contents of b1 is, but maybe you want: b1 ...

5 days ago | 1

| accepted

Answered

How to speed up pairwise difference calculation between vectors under certain condition?

Instead of creating the huge index matrix abs(B-A(i))<=maxdif in each iteration, it is cheaper to search the lower and upper lim...

How to speed up pairwise difference calculation between vectors under certain condition?

Instead of creating the huge index matrix abs(B-A(i))<=maxdif in each iteration, it is cheaper to search the lower and upper lim...

7 days ago | 0

| accepted

Answered

I have 30x30 matrix and need to extrapolate lower triangle numbers

x = rand(5, 5); y = x(tril(true(size(x)))) What is the reason to avoid tril? Maybe: s = size(x); y = x((1:s(1)).' >= (1:s2)...

I have 30x30 matrix and need to extrapolate lower triangle numbers

x = rand(5, 5); y = x(tril(true(size(x)))) What is the reason to avoid tril? Maybe: s = size(x); y = x((1:s(1)).' >= (1:s2)...

7 days ago | 1

Answered

Unable to perform assignment because left and right sides have different number of elements

range(k) = [range(k), [data(i)]]; This cannot work, because range(k) is a scalar, but [range(k), [data(i)]] has 2 elements. By...

Unable to perform assignment because left and right sides have different number of elements

range(k) = [range(k), [data(i)]]; This cannot work, because range(k) is a scalar, but [range(k), [data(i)]] has 2 elements. By...

8 days ago | 0

Answered

Reading a binary data file

fid = fopen('file.dat','r'); if fid <0 error('error opening file %s\n file.dat') end Program_label = fread(fid, [1 4...

Reading a binary data file

fid = fopen('file.dat','r'); if fid <0 error('error opening file %s\n file.dat') end Program_label = fread(fid, [1 4...

8 days ago | 0

Answered

Strange behavior of the editor in the forum

5 months later: Since about a week, at about every 5th or 8th time pressing Ctrl-E my Firefox decides to switch to the first ta...

Strange behavior of the editor in the forum

5 months later: Since about a week, at about every 5th or 8th time pressing Ctrl-E my Firefox decides to switch to the first ta...

8 days ago | 1

Answered

How do I post a picture with my question

The question of how to embed a picture was answered already. Let me encourage all users to really use this feature, which is muc...

How do I post a picture with my question

The question of how to embed a picture was answered already. Let me encourage all users to really use this feature, which is muc...

9 days ago | 1

| accepted

Answered

How can i define variables in gui?

It depends on what "use "audiofile" in math operators" mean. After your code, audiofile is a variable, which contains the signal...

How can i define variables in gui?

It depends on what "use "audiofile" in math operators" mean. After your code, audiofile is a variable, which contains the signal...

9 days ago | 0

| accepted

Answered

How do I add a column to a cell array based on existing values in another column?

Only a beginner so forgive me for the basic question... but I have a cell array (x) of dimensions 1310x2. Column 1 is a unique i...

How do I add a column to a cell array based on existing values in another column?

Only a beginner so forgive me for the basic question... but I have a cell array (x) of dimensions 1310x2. Column 1 is a unique i...

9 days ago | 2