Data scientist at Cohen Veterans Bioscience; Obsessive runner. Professional Interests: Predictive modeling, statistics. (I don't respond to email via author page, but will usually look at a question if you send me a link to it.)

Answered

summing elements of an array until a value appears

Here is one way. % Inputs inputVector = [5 4 3 2 1]; inputValueToFind = 2; % Find the location of the index idxEnd = find...

summing elements of an array until a value appears

Here is one way. % Inputs inputVector = [5 4 3 2 1]; inputValueToFind = 2; % Find the location of the index idxEnd = find...

alrededor de 1 hora ago | 0

Answered

How to translate Wolfram program to Matlab

Almost always, the best and "safest" thing to do is to understand what the underlying code is doing in the old language, and the...

How to translate Wolfram program to Matlab

Almost always, the best and "safest" thing to do is to understand what the underlying code is doing in the old language, and the...

alrededor de 1 hora ago | 0

Answered

create diagonal matrix zeros

a = diag(1:10); a(1,:) = 1:10; a(:,1) = 1:10;

create diagonal matrix zeros

a = diag(1:10); a(1,:) = 1:10; a(:,1) = 1:10;

1 día ago | 0

| accepted

Answered

How would I find the value of a corresponding data set?

When you say "corresponding", do you mean the 5th y(value) or the 3rd? y(index)

How would I find the value of a corresponding data set?

When you say "corresponding", do you mean the 5th y(value) or the 3rd? y(index)

1 día ago | 0

Answered

How to randomly select values in one matrix and make them equal to values of a second matrix?

while ... % <---- condition goes here idx = randi(400); x(idx) = y(idx); end

How to randomly select values in one matrix and make them equal to values of a second matrix?

while ... % <---- condition goes here idx = randi(400); x(idx) = y(idx); end

1 día ago | 0

Answered

how can I find the probabilities of the ecdf function of each duplicate values in y ?

Do you mean you are trying to get these values? histcounts(num_off_time,'Normalization','probability') ans = 0.2000 ...

how can I find the probabilities of the ecdf function of each duplicate values in y ?

Do you mean you are trying to get these values? histcounts(num_off_time,'Normalization','probability') ans = 0.2000 ...

1 día ago | 0

| accepted

Answered

Random order with constraints

If you have the Statistics and Machine Learning Toolbox, you could do it like this: x = sort(randsample(220,20,false)); while ...

Random order with constraints

If you have the Statistics and Machine Learning Toolbox, you could do it like this: x = sort(randsample(220,20,false)); while ...

2 días ago | 0

Answered

Problem with obtain regression equation between 2 data sets

All these methods will give the same coefficient for the y/x sloped if you scale the variables first: rng default N = 10; ...

Problem with obtain regression equation between 2 data sets

All these methods will give the same coefficient for the y/x sloped if you scale the variables first: rng default N = 10; ...

3 días ago | 1

Answered

Cannot use datetime function on {'01 Nov 2019 14:39:50.365'}

s = '01 Nov 2019 14:39:50.365'; datetime(s,'InputFormat',"dd MMM yyyy HH:mm:ss.S")

Cannot use datetime function on {'01 Nov 2019 14:39:50.365'}

s = '01 Nov 2019 14:39:50.365'; datetime(s,'InputFormat',"dd MMM yyyy HH:mm:ss.S")

9 días ago | 0

| accepted

Question

How to determine the x-axis positions of the bars in a grouped bar chart

Suppose I make the following bar chart: figure; bar([1 2],[3 4; 5 6]) How can I programatically find the x-axis locations of e...

15 días ago | 3 answers | 0

Answered

fitting a dual exponential function using nlinfit

I made up some pretend data that looks a little bit like yours, and did your fit. Here is my code: % Make up some pretend data ...

fitting a dual exponential function using nlinfit

I made up some pretend data that looks a little bit like yours, and did your fit. Here is my code: % Make up some pretend data ...

15 días ago | 0

| accepted

Answered

how to change the box width in boxplot?

You chose the "compact" plot style. Do you prefer this version, which is the default (non-compact)? Also, are you sure you ar...

how to change the box width in boxplot?

You chose the "compact" plot style. Do you prefer this version, which is the default (non-compact)? Also, are you sure you ar...

21 días ago | 0

Answered

Array indices must be positive integers or logical values

In this line: hfuncval(k) = hfuncval(k-1); in the first iteration of the for loop, k == 1, so you are attempting to access the...

Array indices must be positive integers or logical values

In this line: hfuncval(k) = hfuncval(k-1); in the first iteration of the for loop, k == 1, so you are attempting to access the...

21 días ago | 0

Answered

How to specify histogram's x and y axis

You can use the xlim and ylim commands.

How to specify histogram's x and y axis

You can use the xlim and ylim commands.

22 días ago | 1

| accepted

Answered

Plotting estimates (fixed effects) of a linear mixed-model

I could find no mention in the documentation of the LinearMixedModel class that there is an equivalent object function or method...

Plotting estimates (fixed effects) of a linear mixed-model

I could find no mention in the documentation of the LinearMixedModel class that there is an equivalent object function or method...

22 días ago | 1

Answered

how to convert to matlab from fortran

You could try f2matlab. It might not get you all the way to the final code you need, but it will probably help.

how to convert to matlab from fortran

You could try f2matlab. It might not get you all the way to the final code you need, but it will probably help.

alrededor de 1 mes ago | 0

Answered

using function to remove elements from a large matrix

idxToKeep = ismember(M(:,2),[1,2,3,11,12]); M = M(idxToKeep,:);

using function to remove elements from a large matrix

idxToKeep = ismember(M(:,2),[1,2,3,11,12]); M = M(idxToKeep,:);

alrededor de 1 mes ago | 0

| accepted

Answered

Creating all possible combination of 0 and 1 in 2D array

Did you mean you just want each possible unique row, rather than each possible unique matrix? justRows = dec2bin(0:2^m-1)-'0' ...

Creating all possible combination of 0 and 1 in 2D array

Did you mean you just want each possible unique row, rather than each possible unique matrix? justRows = dec2bin(0:2^m-1)-'0' ...

alrededor de 1 mes ago | 0

Answered

Creating all possible combination of 0 and 1 in 2D array

% Example choice of m and n n = 2; m = 3; allCombos = reshape(dec2bin(0:2^(n*m)-1)-'0',n,m,[]); allCombos is a 3-dimension...

Creating all possible combination of 0 and 1 in 2D array

% Example choice of m and n n = 2; m = 3; allCombos = reshape(dec2bin(0:2^(n*m)-1)-'0',n,m,[]); allCombos is a 3-dimension...

alrededor de 1 mes ago | 2

Answered

how to rename and Copy Zip File from one location to another location

I think you should be able to first use the movefile command to rename the other file.

how to rename and Copy Zip File from one location to another location

I think you should be able to first use the movefile command to rename the other file.

alrededor de 1 mes ago | 0

Answered

Where is the Compliant Joint Toolbox ?

Let me Google that for you. Looks like it is here.

Where is the Compliant Joint Toolbox ?

Let me Google that for you. Looks like it is here.

alrededor de 1 mes ago | 0

Answered

Storing the results from a loop using tool box functions in a new matrix

I think instead of [lab] = xyz2lab(XYZ,'d65_64') using lab(col,:) = xyz2lab(XYZ,'d65_64') should do what you want

Storing the results from a loop using tool box functions in a new matrix

I think instead of [lab] = xyz2lab(XYZ,'d65_64') using lab(col,:) = xyz2lab(XYZ,'d65_64') should do what you want

alrededor de 1 mes ago | 0

| accepted

Answered

8 coin toss problem

If you have the Statistics and Machine Learning Toolbox, then v = binopdf(0:8,8,0.5)

8 coin toss problem

If you have the Statistics and Machine Learning Toolbox, then v = binopdf(0:8,8,0.5)

alrededor de 1 mes ago | 0

Answered

How large is the MATLAB Student R2019b download

In an admittedly quick search, I could not find this info specifically, but the System Requirements page might be helpful.

How large is the MATLAB Student R2019b download

In an admittedly quick search, I could not find this info specifically, but the System Requirements page might be helpful.

alrededor de 1 mes ago | 0

Answered

How to find and replace stand alone values in a logical array

I think this does what you want: a(strfind([1 a 1],[1 0 1])) = 1; a(strfind([0 a 0],[0 1 0])) = 0;

How to find and replace stand alone values in a logical array

I think this does what you want: a(strfind([1 a 1],[1 0 1])) = 1; a(strfind([0 a 0],[0 1 0])) = 0;

alrededor de 1 mes ago | 2

Answered

How to convert fraction form to decimal form?

I think you want to use the subs command.

How to convert fraction form to decimal form?

I think you want to use the subs command.

alrededor de 1 mes ago | 0

Answered

Setting array indices to a vector of values

You can use sub2ind command to convert the subscripted indices (xVal,yVal) into a single linear index into the array.

Setting array indices to a vector of values

You can use sub2ind command to convert the subscripted indices (xVal,yVal) into a single linear index into the array.

alrededor de 2 meses ago | 0

| accepted

Answered

CAN I use matlab in two different computers

Yes, you can use it on up to four computers, according to this page. (Click on "Learn More".) You just need to download and act...

CAN I use matlab in two different computers

Yes, you can use it on up to four computers, according to this page. (Click on "Learn More".) You just need to download and act...

alrededor de 2 meses ago | 0

| accepted

Answered

Subscript indices must either be real positive integers or logicals.

In this line: np = find(kp > 1.05 & kp <1.2); there are no values of kp that satisfy this condition, so np is empty. That car...

Subscript indices must either be real positive integers or logicals.

In this line: np = find(kp > 1.05 & kp <1.2); there are no values of kp that satisfy this condition, so np is empty. That car...

alrededor de 2 meses ago | 0

| accepted