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

Transparency violation error. Using 'eval' in a 'parfor' loop

Some general hints: load() without catching its output to a variable creates variables dynamically in the workspace. This imped...

Transparency violation error. Using 'eval' in a 'parfor' loop

Some general hints: load() without catching its output to a variable creates variables dynamically in the workspace. This imped...

ein Tag ago | 1

Answered

Matrix multiplication to get covariance matrix

No, there is no chance for a significant speedup or vectorization, because the result of the former iteration is the input of th...

Matrix multiplication to get covariance matrix

No, there is no chance for a significant speedup or vectorization, because the result of the former iteration is the input of th...

ein Tag ago | 0

Answered

Run the same script for multiple folders

See: FAQ: How to access a sequence of files FolderList = dir('C:\Your\BaseFolder\'): FolderList = FolderList([FolderList.isdir...

Run the same script for multiple folders

See: FAQ: How to access a sequence of files FolderList = dir('C:\Your\BaseFolder\'): FolderList = FolderList([FolderList.isdir...

ein Tag ago | 0

Answered

How to create a 7*9 black and white image by using 0 and 1?

T = [0, 0, 0, 0, 0, 0, 0, 0, 0; ... 0, 1, 1, 1, 0, 1, 1, 1, 0; ... 0, 0, 1, 0, 0, 1, 0, 1, 0; ... 0, 0, 1, 0, ...

How to create a 7*9 black and white image by using 0 and 1?

T = [0, 0, 0, 0, 0, 0, 0, 0, 0; ... 0, 1, 1, 1, 0, 1, 1, 1, 0; ... 0, 0, 1, 0, 0, 1, 0, 1, 0; ... 0, 0, 1, 0, ...

ein Tag ago | 1

Answered

How to perfrom indexing on nested cell array ?

Are you aware that cellfun looks really nice, but that the code runs faster with loops? In your case you see, that a simple loo...

How to perfrom indexing on nested cell array ?

Are you aware that cellfun looks really nice, but that the code runs faster with loops? In your case you see, that a simple loo...

ein Tag ago | 1

| accepted

Answered

Using index to name variables

Do not create variables names dynamically. This would store information in the names, where it is hard to access. Use the values...

Using index to name variables

Do not create variables names dynamically. This would store information in the names, where it is hard to access. Use the values...

ein Tag ago | 0

| accepted

Answered

Need help for "error using -mex file"

The message means, that the subfolder "gsl/" cannot be found. Then provide its base folder by the -I parameter. See: https://www...

Need help for "error using -mex file"

The message means, that the subfolder "gsl/" cannot be found. Then provide its base folder by the -I parameter. See: https://www...

ein Tag ago | 0

| accepted

Answered

Filter function in MATLAB

Did you read the documentation already? doc filter doc filtfilt filter() introduces a delay between input and output signals,...

Filter function in MATLAB

Did you read the documentation already? doc filter doc filtfilt filter() introduces a delay between input and output signals,...

ein Tag ago | 0

Answered

different reactions to right/left click

Comparing char vectors by == fails, if the number of characters is not equal. '123' == 'abc' % Working '1234' == '0' % W...

different reactions to right/left click

Comparing char vectors by == fails, if the number of characters is not equal. '123' == 'abc' % Working '1234' == '0' % W...

ein Tag ago | 0

| accepted

Answered

How do I fix the "A METHODS block or END might be missing before the function definition. This might be causing additional error messages." issue.

The conditions are not recognized in the "elseif" commands. If you really want to move them to the next line, insert the line co...

How do I fix the "A METHODS block or END might be missing before the function definition. This might be causing additional error messages." issue.

The conditions are not recognized in the "elseif" commands. If you really want to move them to the next line, insert the line co...

ein Tag ago | 1

Answered

Random line segments confined in a box

figure; axes('XLim', [-0.1, 1.1], 'YLim', [-0.1, 1.1]); nLine = 100; Coor = [0, 1, 1, 0, 0; ... 0, 0, 1, 1, 0]; for...

Random line segments confined in a box

figure; axes('XLim', [-0.1, 1.1], 'YLim', [-0.1, 1.1]); nLine = 100; Coor = [0, 1, 1, 0, 0; ... 0, 0, 1, 1, 0]; for...

2 Tage ago | 2

| accepted

Answered

How to save data from edit text using a push button in a GUI?

"With a pushbutton I want to close the GUI and save all the data from the edit boxes." Closing is easy: close(handle.figure1) ...

How to save data from edit text using a push button in a GUI?

"With a pushbutton I want to close the GUI and save all the data from the edit boxes." Closing is easy: close(handle.figure1) ...

2 Tage ago | 1

| accepted

Answered

readtable interpretes time hh:mm:ss:SSS in different ways

I do not understand the meaning of your file operations. As far as I understand, the problem can be reproduced by: RA = readtab...

readtable interpretes time hh:mm:ss:SSS in different ways

I do not understand the meaning of your file operations. As far as I understand, the problem can be reproduced by: RA = readtab...

2 Tage ago | 0

| accepted

Answered

While loops in ode45

You do not reset erro to inf after the first iteration. Then all following iterations are not entered. Replace: erro = inf; ....

While loops in ode45

You do not reset erro to inf after the first iteration. Then all following iterations are not entered. Replace: erro = inf; ....

2 Tage ago | 0

Answered

Coupled differential equation using ODE 45

Yes, of course the values are 0. The initial value of y(1) is 0. The derivative of y(1) is: dwp0dz = ((s * alpha0 * y(1) * x0)...

Coupled differential equation using ODE 45

Yes, of course the values are 0. The initial value of y(1) is 0. The derivative of y(1) is: dwp0dz = ((s * alpha0 * y(1) * x0)...

2 Tage ago | 1

| accepted

Answered

How can I make sphere using smaller spheres?

r = 0.1; R = 1; [x, y, z] = sphere(12); w = linspace(-R + r, R - r, 1 + R / r); figure; axes('NextPlot', 'add', 'XLim', [-R...

How can I make sphere using smaller spheres?

r = 0.1; R = 1; [x, y, z] = sphere(12); w = linspace(-R + r, R - r, 1 + R / r); figure; axes('NextPlot', 'add', 'XLim', [-R...

2 Tage ago | 2

| accepted

Answered

How to assign a row matrix to another row matrix

The error message suggests: To convert to numeric, use the TABLE2ARRAY function Did you try this already? In one line you w...

How to assign a row matrix to another row matrix

The error message suggests: To convert to numeric, use the TABLE2ARRAY function Did you try this already? In one line you w...

2 Tage ago | 0

Answered

Insert an input to an exe automatically by Command Window

You could use this to inject keystrokes: https://www.mathworks.com/matlabcentral/fileexchange/40001-keyinject The function must...

Insert an input to an exe automatically by Command Window

You could use this to inject keystrokes: https://www.mathworks.com/matlabcentral/fileexchange/40001-keyinject The function must...

2 Tage ago | 1

| accepted

Answered

ODE45 function time step

Avoid using global variables, because they are a shot in your knee. Use a persistent variable instead and reply it to the calle...

ODE45 function time step

Avoid using global variables, because they are a shot in your knee. Use a persistent variable instead and reply it to the calle...

2 Tage ago | 0

Answered

Repeating while loop until the conditions are met

It is not getting clear to me, what you are asking for. So some hints at first: Pi=0; sumPi=0; P=zeros(n,1); for j=1:n ...

Repeating while loop until the conditions are met

It is not getting clear to me, what you are asking for. So some hints at first: Pi=0; sumPi=0; P=zeros(n,1); for j=1:n ...

3 Tage ago | 0

Answered

Turn off "Improve MATLAB by sending user experience" from the command line

What about setting this parameter through the GUI and comparing C:\Users\<USER>\AppData\Roaming\MathWorks\MATLAB\<VErSION>\mat...

Turn off "Improve MATLAB by sending user experience" from the command line

What about setting this parameter through the GUI and comparing C:\Users\<USER>\AppData\Roaming\MathWorks\MATLAB\<VErSION>\mat...

3 Tage ago | 0

Answered

How to create an array from a GUI where the array length changes by user's input?

The easiest way is to omit step 1, but to let the use create as many values as wanted and count them afterwards. There is a nice...

How to create an array from a GUI where the array length changes by user's input?

The easiest way is to omit step 1, but to let the use create as many values as wanted and count them afterwards. There is a nice...

3 Tage ago | 1

| accepted

Answered

How to Count occurrences?

t = 'tagtacagccagtagagttgattccaaggaagtccggctgttgtagagtagc'; tag = 'tag'; result = sum(strfind(lower(t), lower(tag)))

How to Count occurrences?

t = 'tagtacagccagtagagttgattccaaggaagtccggctgttgtagagtagc'; tag = 'tag'; result = sum(strfind(lower(t), lower(tag)))

3 Tage ago | 1

Answered

several plot - subplot for-loop

Maybe: ... subplot(1, length(Files), k); yyaxis left plot(p,ODsatpercent,'bo--'); yyaxis right pl...

several plot - subplot for-loop

Maybe: ... subplot(1, length(Files), k); yyaxis left plot(p,ODsatpercent,'bo--'); yyaxis right pl...

3 Tage ago | 1

Answered

How to doI plot F(x) = [1 -(10/x)]/[1-(100/x^2)] for X ranging from 100 to 1100 at an interval of 50?

x = 100:50:1100; plot(x, (1 - (10 ./ x)) ./ (1 - (100 ./ x.^2))); With some basic maths skills, a simplification is easy: plo...

How to doI plot F(x) = [1 -(10/x)]/[1-(100/x^2)] for X ranging from 100 to 1100 at an interval of 50?

x = 100:50:1100; plot(x, (1 - (10 ./ x)) ./ (1 - (100 ./ x.^2))); With some basic maths skills, a simplification is easy: plo...

3 Tage ago | 2

Answered

How to change output in FOR Loop

Creating variables dynamically has a lot of severe disadvantaged. Using a struct is nicer, safer and more efficient. X = {'JanL...

How to change output in FOR Loop

Creating variables dynamically has a lot of severe disadvantaged. Using a struct is nicer, safer and more efficient. X = {'JanL...

3 Tage ago | 0

Answered

Mis-type append problem

The problem is, that you provide CHAR vectors, but scatter requires numerical arrays. readtable would be smart, but this works ...

Mis-type append problem

The problem is, that you provide CHAR vectors, but scatter requires numerical arrays. readtable would be smart, but this works ...

4 Tage ago | 0

Answered

Error using ode45

The error message means, that you need a function, because the integrator uses input and output arguments for the function to be...

Error using ode45

The error message means, that you need a function, because the integrator uses input and output arguments for the function to be...

6 Tage ago | 0

| accepted

Answered

How to solve this ODE system which involves these integrals?

What about using two further variables? function dx = fcn(z, x) dx = [f1(x(1), x(2)) / x(3); ... f2(x(1), x(2)) / x(4);...

How to solve this ODE system which involves these integrals?

What about using two further variables? function dx = fcn(z, x) dx = [f1(x(1), x(2)) / x(3); ... f2(x(1), x(2)) / x(4);...

6 Tage ago | 0

| accepted