42,181 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

How to make a matrix with negative indexes?

Modify https://www.mathworks.com/matlabcentral/fileexchange/33301-zero-based-indexable-arrays-oop-exercise Another approach is...

How to make a matrix with negative indexes?

Modify https://www.mathworks.com/matlabcentral/fileexchange/33301-zero-based-indexable-arrays-oop-exercise Another approach is...

28 minutes ago | 0

Answered

How I can repeatedly divide a binary image ?

Code for repeatedly dividing was provided at https://www.mathworks.com/matlabcentral/answers/456856-how-can-i-loop-over-a-binary...

How I can repeatedly divide a binary image ?

Code for repeatedly dividing was provided at https://www.mathworks.com/matlabcentral/answers/456856-how-can-i-loop-over-a-binary...

38 minutes ago | 0

Answered

how i can save the value of two signals when they are equal

N = 14; a = zeros(1, N); b = 1; for K = 1 : length(signal_1) if signal_1(K) == signal_2(K) a(b) = signal_1(K); ...

how i can save the value of two signals when they are equal

N = 14; a = zeros(1, N); b = 1; for K = 1 : length(signal_1) if signal_1(K) == signal_2(K) a(b) = signal_1(K); ...

1 hour ago | 0

Answered

Adding multiple fields and values to structure array

Provided you are setting all of the fields of data(k), then you can use data(k) = struct('PairNum', pairNum, 'level', level, 't...

Adding multiple fields and values to structure array

Provided you are setting all of the fields of data(k), then you can use data(k) = struct('PairNum', pairNum, 'level', level, 't...

1 hour ago | 1

| accepted

Answered

How does Matrix(3002:2001:1999998)=0.4 works?

It is due to linear indexing. Variables can be indexed by a single number which is the number of elements from the beginning in ...

How does Matrix(3002:2001:1999998)=0.4 works?

It is due to linear indexing. Variables can be indexed by a single number which is the number of elements from the beginning in ...

2 hours ago | 0

Answered

How can I append the same variables on mat file?

After you have created m = matfile() then new_row_of_values = something appropriate; s = size(m, 'my_variables'); m.my_vari...

How can I append the same variables on mat file?

After you have created m = matfile() then new_row_of_values = something appropriate; s = size(m, 'my_variables'); m.my_vari...

2 hours ago | 1

Answered

Recursive computation using multi gpus

No. Within any one process, in order to send commands to a different GPU, you need to select the GPU. Selecting a GPU synchroni...

Recursive computation using multi gpus

No. Within any one process, in order to send commands to a different GPU, you need to select the GPU. Selecting a GPU synchroni...

4 hours ago | 0

Answered

How to create a sliding window??

Apply regionprops() to find the bounding boxes. Sort the bounding boxes by lower left corner, according to x within y (that is, ...

How to create a sliding window??

Apply regionprops() to find the bounding boxes. Sort the bounding boxes by lower left corner, according to x within y (that is, ...

5 hours ago | 0

Answered

How to use sliding window technique to detect one single line

Use nlfilter() to apply nonlinear algorithms to sliding windows. That said, there are some algorithms that can be much more eff...

How to use sliding window technique to detect one single line

Use nlfilter() to apply nonlinear algorithms to sliding windows. That said, there are some algorithms that can be much more eff...

5 hours ago | 0

Answered

how can I compute memory usage?

You can turn on memory profiling; https://www.mathworks.com/matlabcentral/answers/214247-allocated-freed-self-memory-and-peak-me...

how can I compute memory usage?

You can turn on memory profiling; https://www.mathworks.com/matlabcentral/answers/214247-allocated-freed-self-memory-and-peak-me...

5 hours ago | 0

Answered

ismember 0×0 empty logical array to logic

The obvious answer would seem to be to test if isempty(A) || ~ismember(A,ID) If you were hoping there were a hidden preferenc...

ismember 0×0 empty logical array to logic

The obvious answer would seem to be to test if isempty(A) || ~ismember(A,ID) If you were hoping there were a hidden preferenc...

7 hours ago | 0

Answered

How do I write this equation in Matlab?

There is a trick to solving inequalities: convert them to equalities. P/R < 1 implies P < R implies P + dP == R for some posit...

How do I write this equation in Matlab?

There is a trick to solving inequalities: convert them to equalities. P/R < 1 implies P < R implies P + dP == R for some posit...

7 hours ago | 0

Answered

how can we create database with .mat files ?

Yes, it is possible. It is, however, of low value to do so. .mat files are just files, so they can be read in as arrays of uint...

how can we create database with .mat files ?

Yes, it is possible. It is, however, of low value to do so. .mat files are just files, so they can be read in as arrays of uint...

8 hours ago | 0

Answered

how to make two differnt size array into same

[T3, ia, ib] = intersect(T1, T2); T3Temp = Temp(ia); T3RH = RH(ib); yyaxis left plot(T3, T3RH); yyaxis right plot(T3, R3Te...

how to make two differnt size array into same

[T3, ia, ib] = intersect(T1, T2); T3Temp = Temp(ia); T3RH = RH(ib); yyaxis left plot(T3, T3RH); yyaxis right plot(T3, R3Te...

8 hours ago | 1

| accepted

Answered

Incidence matrix of a graph

If you have constructed a graph() object named G, then full(G.adjacency)

Incidence matrix of a graph

If you have constructed a graph() object named G, then full(G.adjacency)

10 hours ago | 0

Answered

How can I create a loop that doesnt allow the same number to be input twice?

if length(unique(M)) ~= numel(M) error('You entered some number twice') end

How can I create a loop that doesnt allow the same number to be input twice?

if length(unique(M)) ~= numel(M) error('You entered some number twice') end

11 hours ago | 0

Answered

[student] Asking your help to solve an issue with a function creating algebric loop

The problem is not that block: the problem is that you have blocks in which the output is connected to the input, but the calcul...

[student] Asking your help to solve an issue with a function creating algebric loop

The problem is not that block: the problem is that you have blocks in which the output is connected to the input, but the calcul...

11 hours ago | 1

Answered

One instance running issue

Each run of the compiled executable is a separate process. The global variable will be destroyed between runs, same as if you ha...

One instance running issue

Each run of the compiled executable is a separate process. The global variable will be destroyed between runs, same as if you ha...

14 hours ago | 0

Answered

how to prevent reordering of terms by symbolic math functions

Yes, there is a way. You can create a whole bunch of MuPAD code to use the general framework of the internal symbolic engine in ...

how to prevent reordering of terms by symbolic math functions

Yes, there is a way. You can create a whole bunch of MuPAD code to use the general framework of the internal symbolic engine in ...

14 hours ago | 0

Answered

What license would cover the following application: making public videos/live streaming tutorials regarding Matlab/Simulink

Student licences only cover MATLAB use for courses and degree requirements. Home license could potentially cover what you des...

What license would cover the following application: making public videos/live streaming tutorials regarding Matlab/Simulink

Student licences only cover MATLAB use for courses and degree requirements. Home license could potentially cover what you des...

16 hours ago | 0

Answered

How can I average datetimes of my array?

Not array2timetable. Use table2timetable

How can I average datetimes of my array?

Not array2timetable. Use table2timetable

18 hours ago | 0

Answered

Calculating eigenvalues of matrices of symbolic matrices

The symbolic toolbox always considers a resolved symbolic variable to be a scalar, never as a stand-in for a matrix. You would h...

Calculating eigenvalues of matrices of symbolic matrices

The symbolic toolbox always considers a resolved symbolic variable to be a scalar, never as a stand-in for a matrix. You would h...

19 hours ago | 0

Answered

For loop count question

a1 = -70:5:100; a2 = -60:5:60; a3 = -50:10:50; a4 = -40:10:40; N_a1 = length(a1); N_a2 = length(a2); N_a3 = length(a3); N...

For loop count question

a1 = -70:5:100; a2 = -60:5:60; a3 = -50:10:50; a4 = -40:10:40; N_a1 = length(a1); N_a2 = length(a2); N_a3 = length(a3); N...

1 day ago | 0

| accepted

Answered

How can I integrate this function?

planckint = integral(plankck2, 0, 5780, 'ArrayValued', true);

How can I integrate this function?

planckint = integral(plankck2, 0, 5780, 'ArrayValued', true);

1 day ago | 0

Answered

Undefined function or variable 'x'.

You define theta as a vector. Then you call ode45, which will not change theta. Then you test if theta < 0.7854. With theta bein...

Undefined function or variable 'x'.

You define theta as a vector. Then you call ode45, which will not change theta. Then you test if theta < 0.7854. With theta bein...

1 day ago | 0

Answered

please how can i plot this excel data in matab in such a way that the time shows in the x axis

t = readtable('weather data matlab.xlsx'); d = days(t.Time); d.Format = 'hh:mm'; C = t.Temp__C_; plot(d, C);

please how can i plot this excel data in matab in such a way that the time shows in the x axis

t = readtable('weather data matlab.xlsx'); d = days(t.Time); d.Format = 'hh:mm'; C = t.Temp__C_; plot(d, C);

1 day ago | 0

Answered

Sum of a 4D matrix

See https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum

Sum of a 4D matrix

See https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum

1 day ago | 0

Answered

Help with Grid search using parallel computation (substituting for loops using 'parfor')

Effectively, you are trying to do a min() reduction. Unfortunately, min reductions are not supported even if you called min() di...

Help with Grid search using parallel computation (substituting for loops using 'parfor')

Effectively, you are trying to do a min() reduction. Unfortunately, min reductions are not supported even if you called min() di...

1 day ago | 1

| accepted

Answered

How fmincon shifts x0 when it does not strictly satisfy the upper and lower bounds?

For activeSet, sqp, and sqpLegacy: Any x0 value that is less than the lower bound for that entry, is replaced with the lower bo...

How fmincon shifts x0 when it does not strictly satisfy the upper and lower bounds?

For activeSet, sqp, and sqpLegacy: Any x0 value that is less than the lower bound for that entry, is replaced with the lower bo...

1 day ago | 0

Answered

Representing fractions in single-precision floating point

I cannot tell at the moment whether you are using Windows or Linux. Either way, sprintf and fprintf truncate the output of value...

Representing fractions in single-precision floating point

I cannot tell at the moment whether you are using Windows or Linux. Either way, sprintf and fprintf truncate the output of value...

1 day ago | 0