12.199 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 to select a time from one array which is close to the time in another array ?

Prefer to use modern datetime objects instead of cellstrings containing datestr values: A = [{'05:10:34'} {'05:42:52'} {'06:52:...

How to select a time from one array which is close to the time in another array ?

Prefer to use modern datetime objects instead of cellstrings containing datestr values: A = [{'05:10:34'} {'05:42:52'} {'06:52:...

3 Tage ago | 0

Answered

How do I pause Matlab execution to wait for file edits

It is a bad idea to edit M-files during the execution. It would be much better to edit a file, which contains the modified param...

How do I pause Matlab execution to wait for file edits

It is a bad idea to edit M-files during the execution. It would be much better to edit a file, which contains the modified param...

3 Tage ago | 0

Answered

How can I keep just the arrays with 2 is before 3 after random swap 2 numbers.

s = [1,2,3,4,5]; s = s(randperm(numel(s))); % Random permutation? % Or swap 2 elements: index = randperm(numel(s), 2)...

How can I keep just the arrays with 2 is before 3 after random swap 2 numbers.

s = [1,2,3,4,5]; s = s(randperm(numel(s))); % Random permutation? % Or swap 2 elements: index = randperm(numel(s), 2)...

5 Tage ago | 0

| accepted

Answered

Can you help me to correct this error?

while isempty(A)==0 will not work, because the matrix A does not change its size. I guess you mean: while any(A(:) ~= 0) % Or ...

Can you help me to correct this error?

while isempty(A)==0 will not work, because the matrix A does not change its size. I guess you mean: while any(A(:) ~= 0) % Or ...

5 Tage ago | 0

Answered

How can I loop over a binary image to get 4 equal quadrants always?

Using 4 distinct variables is less convenient than reshaping the array: s = size(q1); q2 = reshape(q1, s(1)/2, 2, s(2)/2, 2);...

How can I loop over a binary image to get 4 equal quadrants always?

Using 4 distinct variables is less convenient than reshaping the array: s = size(q1); q2 = reshape(q1, s(1)/2, 2, s(2)/2, 2);...

5 Tage ago | 0

Answered

error using imwrite command

The error message is clear: Either the file is existing already and you cannot overwrite it (maybe it is open in another program...

error using imwrite command

The error message is clear: Either the file is existing already and you cannot overwrite it (maybe it is open in another program...

5 Tage ago | 0

| accepted

Answered

multiply all numbers above a threshold in a matrix by n, but only on certain indices, and keep original matrix dimension

index = (matrix(:, 115) > 0.5); % logical mask matrix(index, 115) = matrix(index, 115) * 100;

multiply all numbers above a threshold in a matrix by n, but only on certain indices, and keep original matrix dimension

index = (matrix(:, 115) > 0.5); % logical mask matrix(index, 115) = matrix(index, 115) * 100;

7 Tage ago | 0

| accepted

Answered

please help with this If else statement

Similar to your C++ code, just with some shorter names for variables to reduce the chance for typos: function main toefl1 = in...

please help with this If else statement

Similar to your C++ code, just with some shorter names for variables to reduce the chance for typos: function main toefl1 = in...

7 Tage ago | 1

| accepted

Answered

Combinations of vectors and matrices

This is faster: function [cn, ci, cc, ca, comb] = MyComb4(n, vn, vi, vc, va) % Get combinations: cn = nchoosek(single(vn), ...

Combinations of vectors and matrices

This is faster: function [cn, ci, cc, ca, comb] = MyComb4(n, vn, vi, vc, va) % Get combinations: cn = nchoosek(single(vn), ...

9 Tage ago | 0

Answered

How to upload 800 csv files that only contains numbers in a cell keeping their names

As I said: The number contain commas as decimal separators. Before such a file can be imported, in much be converted. This costs...

How to upload 800 csv files that only contains numbers in a cell keeping their names

As I said: The number contain commas as decimal separators. Before such a file can be imported, in much be converted. This costs...

9 Tage ago | 0

| accepted

Answered

Place text below patch object

Of course text allows to set the background color: axes text(0.5, 0.5, 'Hello', ... 'Color', 'r', 'BackgroundColor', 'c')...

Place text below patch object

Of course text allows to set the background color: axes text(0.5, 0.5, 'Hello', ... 'Color', 'r', 'BackgroundColor', 'c')...

10 Tage ago | 0

Answered

How to loadmat file and run to my code in guide

[fname, fpath] = uigetfile({'*.mat'}, ... 'Select the Vessel Signal file','multiselect','on'); d = load(fullfile(fpath...

How to loadmat file and run to my code in guide

[fname, fpath] = uigetfile({'*.mat'}, ... 'Select the Vessel Signal file','multiselect','on'); d = load(fullfile(fpath...

11 Tage ago | 1

| accepted

Answered

speed of loop for calculating group version

This is a very bad idea: temp_g = []; for j = 1:ngroups temp_g = [temp_g ,norm(Beta(groups==j,statsIt) - Beta(groups==j,i)...

speed of loop for calculating group version

This is a very bad idea: temp_g = []; for j = 1:ngroups temp_g = [temp_g ,norm(Beta(groups==j,statsIt) - Beta(groups==j,i)...

11 Tage ago | 0

Answered

i cant plot the graph

The function needs 3 inputs: function x = logictic1(r, x0, n) You provide 1 inut only: logistics1(1) Then the values of xo a...

i cant plot the graph

The function needs 3 inputs: function x = logictic1(r, x0, n) You provide 1 inut only: logistics1(1) Then the values of xo a...

11 Tage ago | 0

Answered

Similarity of two .wav files - unsure about the returned error.

Error using horzcat Dimensions of arrays being concatenated are not consistent. data = [x y]; This means the x and y have a d...

Similarity of two .wav files - unsure about the returned error.

Error using horzcat Dimensions of arrays being concatenated are not consistent. data = [x y]; This means the x and y have a d...

11 Tage ago | 1

| accepted

Answered

How to find common rows between two cell arrays containing string values?

What about ismember(A, B, 'rows')? I guess your inputs are: A = ["ABC", "DEF"; ... "HTG", "JUKHI"; ... "RTHG", "...

How to find common rows between two cell arrays containing string values?

What about ismember(A, B, 'rows')? I guess your inputs are: A = ["ABC", "DEF"; ... "HTG", "JUKHI"; ... "RTHG", "...

11 Tage ago | 0

Answered

for loop starting from 1

a = Player{4,1}(:, 1); b = Player{2,1}(:, 2); Output = zeros(length(a)-1, 1); % Pre-allocate Output(1) = sum(b(1:a...

for loop starting from 1

a = Player{4,1}(:, 1); b = Player{2,1}(:, 2); Output = zeros(length(a)-1, 1); % Pre-allocate Output(1) = sum(b(1:a...

11 Tage ago | 0

Answered

I need a loop which puts every (j,k) element of every matrix in different columns.

What about: d = cat(3, O{:}); d = permute(d, [3,1,2]) Now you have the wanted columns as first index.

I need a loop which puts every (j,k) element of every matrix in different columns.

What about: d = cat(3, O{:}); d = permute(d, [3,1,2]) Now you have the wanted columns as first index.

12 Tage ago | 1

| accepted

Answered

How to make an image take different RGB values?

LUT = randi([0, 255], 256, 3, 'uint8'); % The look up table Img = randi([0, 255], 640, 480, 3, 'uint8'); % The image ...

How to make an image take different RGB values?

LUT = randi([0, 255], 256, 3, 'uint8'); % The look up table Img = randi([0, 255], 640, 480, 3, 'uint8'); % The image ...

12 Tage ago | 1

| accepted

Answered

How to create a loop

e = zeros(1, 14); % Pre-allocate for k = 2:14 e(k) = e(k-1) * (1 + ge) / (1 + y); end

How to create a loop

e = zeros(1, 14); % Pre-allocate for k = 2:14 e(k) = e(k-1) * (1 + ge) / (1 + y); end

12 Tage ago | 0

Answered

how can i determine the time it took to run an input?

You can use tic and toc, or more accurately timeit.

how can i determine the time it took to run an input?

You can use tic and toc, or more accurately timeit.

12 Tage ago | 0

Answered

Read csv file containing text and numbers for very large dataset (beyond xls limit)

Please mention, what "very large" means. Some people call a file with 1MB "large" already, because they cannot read it anymore, ...

Read csv file containing text and numbers for very large dataset (beyond xls limit)

Please mention, what "very large" means. Some people call a file with 1MB "large" already, because they cannot read it anymore, ...

12 Tage ago | 0

Answered

if string is abc return value

Maybe: [fPath, fName, fExt] = fileparts(filename); if endsWith(fName, 'a ') % With the space as in your example xxx = 1;...

if string is abc return value

Maybe: [fPath, fName, fExt] = fileparts(filename); if endsWith(fName, 'a ') % With the space as in your example xxx = 1;...

13 Tage ago | 1

| accepted

Answered

Error with Sortrow function in Matlab R2016b

Start with omitting the brute clearing header: clc; clear all; close all; It is a waste of time to kill everything. Bette...

Error with Sortrow function in Matlab R2016b

Start with omitting the brute clearing header: clc; clear all; close all; It is a waste of time to kill everything. Bette...

13 Tage ago | 0

Answered

Need help with steps and code to complete this.

Please read the "Getting Started" chapters of the documentation and search in the net for "Matlab onramp" to get a short instruc...

Need help with steps and code to complete this.

Please read the "Getting Started" chapters of the documentation and search in the net for "Matlab onramp" to get a short instruc...

13 Tage ago | 0

Answered

Tryin to perform a iteration, no sucess

These lines will no do, what you expect: elseif 0 > ecij > -0.002 Matlab evaluates them from left to right. In the first step...

Tryin to perform a iteration, no sucess

These lines will no do, what you expect: elseif 0 > ecij > -0.002 Matlab evaluates them from left to right. In the first step...

13 Tage ago | 1

Answered

Vectorizing code for runtime optimization (nested loops)

v_xb = abs(v(t,1)-v(z,1)); This looks symmetric. Is the output symmteric (I cann test this currently). Then it should be suffic...

Vectorizing code for runtime optimization (nested loops)

v_xb = abs(v(t,1)-v(z,1)); This looks symmetric. Is the output symmteric (I cann test this currently). Then it should be suffic...

13 Tage ago | 1

| accepted

Answered

I want to give an output to imread function.

The question is not meaningful. As the documentation explains, imread reads a file from the disk: doc imread Providing a strin...

I want to give an output to imread function.

The question is not meaningful. As the documentation explains, imread reads a file from the disk: doc imread Providing a strin...

13 Tage ago | 0

| accepted

Answered

Is 2010a version compatible with 2019b version?

No, Matlab R2010a and 2019a are not 100% compatible. Of course they are not backward compatible: R2019a uses the modern string t...

Is 2010a version compatible with 2019b version?

No, Matlab R2010a and 2019a are not 100% compatible. Of course they are not backward compatible: R2019a uses the modern string t...

13 Tage ago | 0

| accepted

Answered

Question for solving ODE using one function.

The standard approach would be: distance: X(1) velocity: X(2) accleration: X(3) pressure: X(4) Then you can evaluate the de...

Question for solving ODE using one function.

The standard approach would be: distance: X(1) velocity: X(2) accleration: X(3) pressure: X(4) Then you can evaluate the de...

13 Tage ago | 0