42,624 total contributions since 2011

I do not do free private consulting. If you want to bring my attention to something, send a link to the MATLAB Answers location.

Answered

mexmaci64 and dylib issue

As your executable is not in /Applications you might be able to use setenv to set LD_LIBRARY_PATH. However if this is being run ...

mexmaci64 and dylib issue

As your executable is not in /Applications you might be able to use setenv to set LD_LIBRARY_PATH. However if this is being run ...

6 hours ago | 0

Answered

Reference to non-existent field

You solve() on four equations involving 18 variables. If it found a solution at all, it is not likely to be for the four variabl...

Reference to non-existent field

You solve() on four equations involving 18 variables. If it found a solution at all, it is not likely to be for the four variabl...

21 hours ago | 0

Answered

use nvidia drivers instead of opengl

opengl save hardware then quit and re-enter MATLAB. You could also consider using hardwarebasic instead of hardware.

use nvidia drivers instead of opengl

opengl save hardware then quit and re-enter MATLAB. You could also consider using hardwarebasic instead of hardware.

1 day ago | 0

| accepted

Answered

Why does linspace create row instead of column?

The main reason is that row vectors take less screen space to print out -- easier to read, and less print-out (remember, MATLAB ...

Why does linspace create row instead of column?

The main reason is that row vectors take less screen space to print out -- easier to read, and less print-out (remember, MATLAB ...

1 day ago | 2

| accepted

Answered

Curve fitting with an if statement

y = @(x) ((a0*(1-exp(-b0*(x-c0)))).*(x>=c0)) + ((a1*(1-exp(-b1*(x-c1)))).*(x>=c1))

Curve fitting with an if statement

y = @(x) ((a0*(1-exp(-b0*(x-c0)))).*(x>=c0)) + ((a1*(1-exp(-b1*(x-c1)))).*(x>=c1))

1 day ago | 0

| accepted

Answered

How to find first '1' in every row

A = [ 0 0 0 0 0 0 1 1 1 1 0 0; 0 0 0 0 0 1 1 1 1 0 0 0; 0 0 0 0 0 0 1 1 1 1 0 0]; c = sum(cumprod(~A,2),2)+1; I do sometimes...

How to find first '1' in every row

A = [ 0 0 0 0 0 0 1 1 1 1 0 0; 0 0 0 0 0 1 1 1 1 0 0 0; 0 0 0 0 0 0 1 1 1 1 0 0]; c = sum(cumprod(~A,2),2)+1; I do sometimes...

1 day ago | 0

Answered

How to convert a column vector into an image

nrow = 6; ncol = 6; B = full( sparse(C(:,1), C(:,2), A, nrow, ncol) ); Or nrow = 6; ncol = 6; B = accumarray(C, A(:), [nrow ...

How to convert a column vector into an image

nrow = 6; ncol = 6; B = full( sparse(C(:,1), C(:,2), A, nrow, ncol) ); Or nrow = 6; ncol = 6; B = accumarray(C, A(:), [nrow ...

1 day ago | 0

| accepted

Answered

s-function error

We can predict that set_K_parameter has side effects: you call it inside the loop but you never use the output values. u_dat.J...

s-function error

We can predict that set_K_parameter has side effects: you call it inside the loop but you never use the output values. u_dat.J...

1 day ago | 0

Answered

Arithmetic problem with for loop

l = zeros(1,N); %creating and empty array l(1) = ((3*(10^8))/(2*f1)); %formula for i = 2:N l(i) = taper1 * l(i - 1); ...

Arithmetic problem with for loop

l = zeros(1,N); %creating and empty array l(1) = ((3*(10^8))/(2*f1)); %formula for i = 2:N l(i) = taper1 * l(i - 1); ...

2 days ago | 0

| accepted

Answered

Xeon Phi Knights Mill

Yes, you can use MATLAB with Intel Xeon Phi processors (not co-processors). See though https://www.mathworks.com/matlabcentral/...

Xeon Phi Knights Mill

Yes, you can use MATLAB with Intel Xeon Phi processors (not co-processors). See though https://www.mathworks.com/matlabcentral/...

2 days ago | 0

| accepted

Answered

Why does it take so long for Application Compiled exe to execute?

The first time you run, it has to break out the CTF archive as well as everything else. Each time you run it has to check the...

Why does it take so long for Application Compiled exe to execute?

The first time you run, it has to break out the CTF archive as well as everything else. Each time you run it has to check the...

2 days ago | 1

| accepted

Answered

Error: index must be a positive integer or logical.

You are confusing formula and indexing. In MATLAB, except under some circumstances involving symbolic variables, every time you...

Error: index must be a positive integer or logical.

You are confusing formula and indexing. In MATLAB, except under some circumstances involving symbolic variables, every time you...

2 days ago | 2

| accepted

Answered

How is it possible that vpasolve gives empty vectors when there are solutions?

vpasolve() does a modified newton search. This can involve projecting outside of any given bounds even though the solution is ...

How is it possible that vpasolve gives empty vectors when there are solutions?

vpasolve() does a modified newton search. This can involve projecting outside of any given bounds even though the solution is ...

2 days ago | 0

| accepted

Answered

Simulated annealing for optimization

Generally speaking, simulated annealing can be used to solve QAP, but it would likely be much much slower than a routine designe...

Simulated annealing for optimization

Generally speaking, simulated annealing can be used to solve QAP, but it would likely be much much slower than a routine designe...

2 days ago | 1

Answered

Importing CSV files into MATLAB

In R2019a there is now readmatrix() for reading numeric values (not mixed data type). Before that, you can use readtable() and ...

Importing CSV files into MATLAB

In R2019a there is now readmatrix() for reading numeric values (not mixed data type). Before that, you can use readtable() and ...

2 days ago | 1

| accepted

Answered

Problem with Psychtoolbox on Dell XPS15 9560

This is not a MATLAB issue. See http://psychtoolbox.org/docs/SyncTrouble for explanation and possible solutions.

Problem with Psychtoolbox on Dell XPS15 9560

This is not a MATLAB issue. See http://psychtoolbox.org/docs/SyncTrouble for explanation and possible solutions.

2 days ago | 0

Answered

How can I change symbolic displays to decimal displays?

There are several ways to approximate a number or change the display in Symbolic Math Toolbox. To approximate a numeric value i...

How can I change symbolic displays to decimal displays?

There are several ways to approximate a number or change the display in Symbolic Math Toolbox. To approximate a numeric value i...

2 days ago | 3

| accepted

Answered

How to set CurrentTime for VideoReader in parfor loop

"Timestamp of the video frame to read, specified as a numeric scalar. The timestamp is specified in seconds from the start of th...

How to set CurrentTime for VideoReader in parfor loop

"Timestamp of the video frame to read, specified as a numeric scalar. The timestamp is specified in seconds from the start of th...

3 days ago | 0

Answered

Why do I get a error that says "subscript indices must either be rea positive integers or logicals" when run set(gca,'fontsize',20)?

You accidentally created a variable named set

Why do I get a error that says "subscript indices must either be rea positive integers or logicals" when run set(gca,'fontsize',20)?

You accidentally created a variable named set

3 days ago | 2

Answered

How to find all coordinates of extremes of two variable function?

https://www.mathworks.com/help/matlab/ref/polyder.html and roots()

How to find all coordinates of extremes of two variable function?

https://www.mathworks.com/help/matlab/ref/polyder.html and roots()

3 days ago | 0

Answered

How to edit scatter plot legend?

Every scatter call generates a graphics object and by default legend draws labels by order of graphics object.

How to edit scatter plot legend?

Every scatter call generates a graphics object and by default legend draws labels by order of graphics object.

3 days ago | 0

Answered

is there any way to replace this code part with an equivalent part that runs faster?

As you appear to be running those in a loop, move the ones(300,500) to outside the loop. You do not appear to be...

is there any way to replace this code part with an equivalent part that runs faster?

As you appear to be running those in a loop, move the ones(300,500) to outside the loop. You do not appear to be...

3 days ago | 0

Answered

How to display multiple string outputs in a static text box in GUI

Set the 'Max' property of the uicontrol style 'text' to more than 1. The text box will then be able to display a cell array of c...

How to display multiple string outputs in a static text box in GUI

Set the 'Max' property of the uicontrol style 'text' to more than 1. The text box will then be able to display a cell array of c...

3 days ago | 0

Answered

case of two mappings

%mapping #1: x -> x^2 %mapping #2: x -> x/2 + 1 mapping1 = @(x) x.^2; mapping2 = @(x) x/2 + 1; map1_2 = @(x) mapping2(ma...

case of two mappings

%mapping #1: x -> x^2 %mapping #2: x -> x/2 + 1 mapping1 = @(x) x.^2; mapping2 = @(x) x/2 + 1; map1_2 = @(x) mapping2(ma...

3 days ago | 0

Answered

Image aquisition with high speed camera

The approaches you describe cannot work. You need a hardware trigger for constant frame rate. However if you were using an ni...

Image aquisition with high speed camera

The approaches you describe cannot work. You need a hardware trigger for constant frame rate. However if you were using an ni...

3 days ago | 0

| accepted

Answered

Typing an equation in matlab with greek letters

syms kB T D0 Pi = evalin(symengine, '`π`'); nu = evalin(symengine, '`η`'); rs=(kB*T)/(4*Pi*nu*D0); rs = (T*kB)/(4*D0*`η`...

Typing an equation in matlab with greek letters

syms kB T D0 Pi = evalin(symengine, '`π`'); nu = evalin(symengine, '`η`'); rs=(kB*T)/(4*Pi*nu*D0); rs = (T*kB)/(4*D0*`η`...

4 days ago | 0

| accepted

Answered

How to pcolor and convert a matrix 4D to 2D?

slice() is the easiest way, but you can just index and squeeze() and pcolor if the depth is one of the levels exactly matching a...

How to pcolor and convert a matrix 4D to 2D?

slice() is the easiest way, but you can just index and squeeze() and pcolor if the depth is one of the levels exactly matching a...

4 days ago | 0

| accepted

Answered

how convert pixel to mm for a mat file using Matlab?

Pixels have no inherent size. 11x11 matrix of pixels could be representing picometers or gigaparsecs. You need some kind of refe...

how convert pixel to mm for a mat file using Matlab?

Pixels have no inherent size. 11x11 matrix of pixels could be representing picometers or gigaparsecs. You need some kind of refe...

4 days ago | 0

| accepted

Answered

vec2ind problem?

The behavior for that case is undefined, so it is permitted to return anything it wants.

vec2ind problem?

The behavior for that case is undefined, so it is permitted to return anything it wants.

4 days ago | 0