43.320 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

Read Date time series format

S = fileread('update_engine.txt'); timestamps = regexp(S, '^.(.{18})', 'lineanchors', 'match'); ts_dt = datetime(timestamps, '...

Read Date time series format

S = fileread('update_engine.txt'); timestamps = regexp(S, '^.(.{18})', 'lineanchors', 'match'); ts_dt = datetime(timestamps, '...

alrededor de 8 horas ago | 0

Answered

Error in audio uploading time.

You need to tell audiowriter that the sample rate, FS, is 8000.

Error in audio uploading time.

You need to tell audiowriter that the sample rate, FS, is 8000.

alrededor de 15 horas ago | 0

Answered

How to plot a series of numbers which some of them are inf?

plot(X, min(Y, ValueYouWantPlottedInsteadOfInf))

How to plot a series of numbers which some of them are inf?

plot(X, min(Y, ValueYouWantPlottedInsteadOfInf))

alrededor de 18 horas ago | 0

Answered

optimization error ,when i used fmincon for three variables,getting same intial guess value in result

function [fval]=weight_testvariable(X) [...] X=[0.001;0.006;0.4]; You are ignoring the input and always calculating the same ...

optimization error ,when i used fmincon for three variables,getting same intial guess value in result

function [fval]=weight_testvariable(X) [...] X=[0.001;0.006;0.4]; You are ignoring the input and always calculating the same ...

alrededor de 18 horas ago | 0

| accepted

Answered

How select a first value from the binary matrix ?

[~,idx] = max(matrix); output = sparse(idx,1:size(matrix,2),1,size(matrix,1),size(matrix,2)); Note: in the case where there ar...

How select a first value from the binary matrix ?

[~,idx] = max(matrix); output = sparse(idx,1:size(matrix,2),1,size(matrix,1),size(matrix,2)); Note: in the case where there ar...

alrededor de 19 horas ago | 1

Answered

Unique not working - may be due to different datatypes in array

Those are not different datatypes. When you see the same array displaying 7.00000000000000 and 7 both, then what it tells you ...

Unique not working - may be due to different datatypes in array

Those are not different datatypes. When you see the same array displaying 7.00000000000000 and 7 both, then what it tells you ...

alrededor de 20 horas ago | 1

| accepted

Answered

how can call a function

Example: N = 100; o = zeros(N,1); a = zeros(N,1); b = zeros(N,1); c = zeros(N,1); d = zeros(N,1); for idx = 1 : N X = ra...

how can call a function

Example: N = 100; o = zeros(N,1); a = zeros(N,1); b = zeros(N,1); c = zeros(N,1); d = zeros(N,1); for idx = 1 : N X = ra...

1 día ago | 0

Answered

how to use QPBLUR in Matlab?

QPBLUR appears to have been implemented as part of SNOPT which you would obtain a license for from http://ccom.ucsd.edu/~optimiz...

how to use QPBLUR in Matlab?

QPBLUR appears to have been implemented as part of SNOPT which you would obtain a license for from http://ccom.ucsd.edu/~optimiz...

1 día ago | 0

Answered

"Index exceeds matrix dimensions."

Ztramo is an fi by co by noZ matrix. inv(Ztramo(:,:,i)) is a fi by co matrix if it works at all, which can only happen if fi an...

"Index exceeds matrix dimensions."

Ztramo is an fi by co by noZ matrix. inv(Ztramo(:,:,i)) is a fi by co matrix if it works at all, which can only happen if fi an...

1 día ago | 0

| accepted

Answered

plotting multiple surfaces out of a 3d variable

Look in the File Exchange for "vol3d v2" Or perhaps you should just use slice https://www.mathworks.com/help/matlab/ref/slice.h...

plotting multiple surfaces out of a 3d variable

Look in the File Exchange for "vol3d v2" Or perhaps you should just use slice https://www.mathworks.com/help/matlab/ref/slice.h...

1 día ago | 0

| accepted

Answered

Is there a way to continue operation during input()?

https://www.mathworks.com/matlabcentral/fileexchange/8297-getkeywait The below two mostly rely on Psychtoolbox https://ww...

Is there a way to continue operation during input()?

https://www.mathworks.com/matlabcentral/fileexchange/8297-getkeywait The below two mostly rely on Psychtoolbox https://ww...

2 días ago | 0

Answered

How to set constraints of griddata results are all non-negative?

The griddata and interp1 and interp2 methods that do interpolation (so everything except nearest or next or prev) are all subjec...

How to set constraints of griddata results are all non-negative?

The griddata and interp1 and interp2 methods that do interpolation (so everything except nearest or next or prev) are all subjec...

2 días ago | 0

Answered

Store function in an array

A = @(c) 3.*c +1; B= @(c) [A(c) A(c) A(c);... A(c) A(c) A(c);... A(c) A(c) A(c)]; C= @(c) det(B(c)); D= f...

Store function in an array

A = @(c) 3.*c +1; B= @(c) [A(c) A(c) A(c);... A(c) A(c) A(c);... A(c) A(c) A(c)]; C= @(c) det(B(c)); D= f...

2 días ago | 0

| accepted

Answered

Why do I not get the whole domain plotted?

You do not get a plot up to 20E9 because your calculation overflows to infinity. The below does not overflow to infinity, but i...

Why do I not get the whole domain plotted?

You do not get a plot up to 20E9 because your calculation overflows to infinity. The below does not overflow to infinity, but i...

2 días ago | 0

Answered

How can I set the colors in the legend if I show a number of legend elements which is lower thatn the number of plotted functions?

The trick for custom legends is to use for k = 1:num2show bh(k) = bar(nan, 'color', BarColors(k, :) ; end legend...

How can I set the colors in the legend if I show a number of legend elements which is lower thatn the number of plotted functions?

The trick for custom legends is to use for k = 1:num2show bh(k) = bar(nan, 'color', BarColors(k, :) ; end legend...

3 días ago | 0

Answered

ode for different time intervals

It is valid to test if t < stoptime1 inside an ode function. However, you need to make two calls to ode45 [t1, y1] ...

ode for different time intervals

It is valid to test if t < stoptime1 inside an ode function. However, you need to make two calls to ode45 [t1, y1] ...

3 días ago | 1

| accepted

Answered

Cpu usage in parrallel running mode

Have a look at the attached modified version of your code and see if it does what you want. I am not confident that my changes m...

Cpu usage in parrallel running mode

Have a look at the attached modified version of your code and see if it does what you want. I am not confident that my changes m...

3 días ago | 0

Answered

index exceeds the number of array elements error

Looking at your code, I speculate that a is datatype uint8() When you have a/B with a uint8 divided by a double or another uin...

index exceeds the number of array elements error

Looking at your code, I speculate that a is datatype uint8() When you have a/B with a uint8 divided by a double or another uin...

3 días ago | 0

| accepted

Answered

How to use textscan on a cell array without a loop?

See my answer at https://www.mathworks.com/matlabcentral/answers/476452-splitting-one-column-into-multiple-columns# on how to pr...

How to use textscan on a cell array without a loop?

See my answer at https://www.mathworks.com/matlabcentral/answers/476452-splitting-one-column-into-multiple-columns# on how to pr...

3 días ago | 0

Answered

how do i re-run a script so that it takes the updated information from another script?

MATLAB will normally notice changes to .m files that are on the current path, but not if they are installed under the MATLAB ins...

how do i re-run a script so that it takes the updated information from another script?

MATLAB will normally notice changes to .m files that are on the current path, but not if they are installed under the MATLAB ins...

3 días ago | 0

Answered

How do I get subs to behave as desired for symbolic expressions ... does collect change an expression?

collect(f,x) is a different expression with a different internal symbol than f is. isAlways(f==collect(f,x)) It is tempting to...

How do I get subs to behave as desired for symbolic expressions ... does collect change an expression?

collect(f,x) is a different expression with a different internal symbol than f is. isAlways(f==collect(f,x)) It is tempting to...

3 días ago | 0

Answered

Splitting one column into multiple columns

input = {'0.17 1.7285 0.001763792 1.000977 56651.41 0.000017652 DHT11, OK, 35.0,'; ...

Splitting one column into multiple columns

input = {'0.17 1.7285 0.001763792 1.000977 56651.41 0.000017652 DHT11, OK, 35.0,'; ...

3 días ago | 1

Answered

How to find first row with a nonzero element in an image matrix?

find(any(any(YourImage, 3),2),1,'first')

How to find first row with a nonzero element in an image matrix?

find(any(any(YourImage, 3),2),1,'first')

3 días ago | 0

| accepted

Answered

What is the meaning of "Index in position 1 exceeds array bounds (must not exceed 1)".

Use the flow shown in https://www.mathworks.com/help/symbolic/odefunction.html#bvlo6zg-1 Replace [M,F]=massMatrixForm(eqs,vars...

What is the meaning of "Index in position 1 exceeds array bounds (must not exceed 1)".

Use the flow shown in https://www.mathworks.com/help/symbolic/odefunction.html#bvlo6zg-1 Replace [M,F]=massMatrixForm(eqs,vars...

3 días ago | 1

Answered

concatenating arrays and matrix

Borrow my code from your previous question https://www.mathworks.com/matlabcentral/answers/475006-threshold-multiple-values-at-t...

concatenating arrays and matrix

Borrow my code from your previous question https://www.mathworks.com/matlabcentral/answers/475006-threshold-multiple-values-at-t...

3 días ago | 0

| accepted

Answered

Write line by line a separated .csv file with a string \t an integer \t [a n*2 matrix written in line with commas and semicolon]

You will find it tricky to output the variable-length data if you use fprintf() in vectorized form. It is possible, but the code...

Write line by line a separated .csv file with a string \t an integer \t [a n*2 matrix written in line with commas and semicolon]

You will find it tricky to output the variable-length data if you use fprintf() in vectorized form. It is possible, but the code...

3 días ago | 0

Answered

Simulink Question - How to input a decimal value and output hexadecimal string?

Which release are you using? Until R2019a, signals cannot be char. The work-around is to return uint8(dec2hex(value,SIZE)) . Whe...

Simulink Question - How to input a decimal value and output hexadecimal string?

Which release are you using? Until R2019a, signals cannot be char. The work-around is to return uint8(dec2hex(value,SIZE)) . Whe...

3 días ago | 0

Answered

Trimming matrices to smallest size

minsize = min(cell2mat(cellfun(@size, S(:), 'uniform', 0))); newS = cellfun(@(M) M(1:minsize(1), 1:minsize(2), 1:minsize(3)), S...

Trimming matrices to smallest size

minsize = min(cell2mat(cellfun(@size, S(:), 'uniform', 0))); newS = cellfun(@(M) M(1:minsize(1), 1:minsize(2), 1:minsize(3)), S...

3 días ago | 0

| accepted

Answered

How do i fix error : 'model' parameter must be a character vector?

[net,tr] = train(net, data_norm,group); y = sim(net, data_norm); y is going to be numeric and the same size as group result =...

How do i fix error : 'model' parameter must be a character vector?

[net,tr] = train(net, data_norm,group); y = sim(net, data_norm); y is going to be numeric and the same size as group result =...

3 días ago | 0

Answered

How do I allow user to choose either a folder or an image(or selective images) to run the rest of the functions?

choice = menu('How do you want to select images?', 'by folder', 'individual image'); switch choice case 0 %user c...

How do I allow user to choose either a folder or an image(or selective images) to run the rest of the functions?

choice = menu('How do you want to select images?', 'by folder', 'individual image'); switch choice case 0 %user c...

3 días ago | 0