12,410 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

Solving all math and teaching it as you go

This will be an extremely demanding project. You find some software which can simplify symbolic expressions, e.g. Matlab's Symbo...

Solving all math and teaching it as you go

This will be an extremely demanding project. You find some software which can simplify symbolic expressions, e.g. Matlab's Symbo...

3 days ago | 2

| accepted

Answered

Help running a while loop?

Use a for loop if the number of steps is known in advance: A(1) = 1E10; dt = 0.1; for t = 1:1001 dA(t) = -0.005 * A(t); ...

Help running a while loop?

Use a for loop if the number of steps is known in advance: A(1) = 1E10; dt = 0.1; for t = 1:1001 dA(t) = -0.005 * A(t); ...

3 days ago | 0

Answered

how to initialize the permutation sequence ?

Maybe you mean: T = num2cell(randperm(65536, 65536));

how to initialize the permutation sequence ?

Maybe you mean: T = num2cell(randperm(65536, 65536));

3 days ago | 0

| accepted

Answered

How to create a vector by iteration

The break stops the for loop, but there is no exit from the outer while loop: while true for ii = 1 : length(t) Fne...

How to create a vector by iteration

The break stops the for loop, but there is no exit from the outer while loop: while true for ii = 1 : length(t) Fne...

3 days ago | 0

| accepted

Answered

How can a code run on a single image perfectly, but the same code on an entire database crashes? Where am I going wrong?

Use the debugger to find the reason of the problem. Let Matlab stop, when the error occurs: dbstop if error Then run the code ...

How can a code run on a single image perfectly, but the same code on an entire database crashes? Where am I going wrong?

Use the debugger to find the reason of the problem. Let Matlab stop, when the error occurs: dbstop if error Then run the code ...

3 days ago | 0

Answered

Mystery Error; same code runs fine the 2nd time, but not the 1st!

Without seeing the relevant part of the code, answering is based on guessing. I guess, that your code is a script and not a fun...

Mystery Error; same code runs fine the 2nd time, but not the 1st!

Without seeing the relevant part of the code, answering is based on guessing. I guess, that your code is a script and not a fun...

3 days ago | 0

Answered

How do you remove duplicates of nested cells?

A loop approach: 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 approach: C = RomanticGestures; n = numel(C); remove = false(1, n); for i1 = 1:n for i2 = i1 + 1:n if ~...

3 days ago | 0

Answered

How do I convert to Mex from Cpp using Xcode ver 10

Wow, what an inefficient communication. As Walter has said already, the line const int *DimsBness; must be changed to co...

How do I convert to Mex from Cpp using Xcode ver 10

Wow, what an inefficient communication. As Walter has said already, the line const int *DimsBness; must be changed to co...

5 days ago | 1

Answered

Access index in cells.

What ever app.subImage was before, after: app.subImage = round(app.SliderChosenCell.Value); it is a scalar number with an inte...

Access index in cells.

What ever app.subImage was before, after: app.subImage = round(app.SliderChosenCell.Value); it is a scalar number with an inte...

5 days ago | 0

Answered

Graph with string variable

You did not even make an attempt? data = readmatrix('data.xlsx'); plot(data(:, 1), data(:, 2), 'r', ... data(:, 1), data...

Graph with string variable

You did not even make an attempt? data = readmatrix('data.xlsx'); plot(data(:, 1), data(:, 2), 'r', ... data(:, 1), data...

5 days ago | 0

Answered

Need help creating a for loop

v = nonzeros((5:5:95).' .* fliplr(triu(ones(19)))).'

Need help creating a for loop

v = nonzeros((5:5:95).' .* fliplr(triu(ones(19)))).'

6 days ago | 0

Answered

How to write strings and numbers to a text file

Do you really want to create: *DIM,table_press_data_1,TABLE,6146,120,1,PN,PT *TREAD,table_press_data_1,'press_data_1','csv',''...

How to write strings and numbers to a text file

Do you really want to create: *DIM,table_press_data_1,TABLE,6146,120,1,PN,PT *TREAD,table_press_data_1,'press_data_1','csv',''...

6 days ago | 0

Answered

Why is ODE45 using so many intervals?

Do you want to reduce the number of evaluated steps to reduce the processing time, or is it enough to reduce the size of teh out...

Why is ODE45 using so many intervals?

Do you want to reduce the number of evaluated steps to reduce the processing time, or is it enough to reduce the size of teh out...

7 days ago | 1

Answered

Rotating 3D cloud matrix data

Multiplacte the data with a rotation matrix, e.g. obtained by: https://www.mathworks.com/matlabcentral/fileexchange/66446-rotati...

Rotating 3D cloud matrix data

Multiplacte the data with a rotation matrix, e.g. obtained by: https://www.mathworks.com/matlabcentral/fileexchange/66446-rotati...

7 days ago | 0

Answered

What is the efficient way to parse file without fscanf or testscan

I've created a test file at first: fid = fopen('myfile.txt', 'w'); fprintf(fid,'%.0g %16f %16f %16f %8f %8f\n', rand(6, n)); ...

What is the efficient way to parse file without fscanf or testscan

I've created a test file at first: fid = fopen('myfile.txt', 'w'); fprintf(fid,'%.0g %16f %16f %16f %8f %8f\n', rand(6, n)); ...

7 days ago | 0

| accepted

Answered

How can I convert a binary fraction to decimal?

'11001' means: 1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 + 1*2^4 or: [1,1,0,0,1] * 2 .^ (4:-1:0).' (this is what happens inside bin2dec - ...

How can I convert a binary fraction to decimal?

'11001' means: 1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 + 1*2^4 or: [1,1,0,0,1] * 2 .^ (4:-1:0).' (this is what happens inside bin2dec - ...

7 days ago | 2

| accepted

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...

8 days 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...

10 days 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...

10 days ago | 1

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...

12 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...

12 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]))

12 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...

12 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 ...

12 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 ...

13 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...

13 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...

13 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...

13 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); ...

13 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...

13 days ago | 0

| accepted