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

multivariable regression, known structure, calculate coefficients

If you have the Statistics and Machine Learning Toolbox, you should be able to use the fitnlm function.

multivariable regression, known structure, calculate coefficients

If you have the Statistics and Machine Learning Toolbox, you should be able to use the fitnlm function.

3 dagen ago | 0

Answered

Error: Unable to perform assignment because the left and right sides have a different number of elements.

In this line S(i+1) = S(i) + (s1 + 2*s2 + 2*s3 + s4)/6; the variables s1, s2, s3, and s4 are all row vectors with 300 elements...

Error: Unable to perform assignment because the left and right sides have a different number of elements.

In this line S(i+1) = S(i) + (s1 + 2*s2 + 2*s3 + s4)/6; the variables s1, s2, s3, and s4 are all row vectors with 300 elements...

9 dagen ago | 0

Answered

Using cellfun and regexp question

I think this does what you want. storedSamplerates{1} = 'SAMPLERATE: 50000'; storedSamplerates{2} = 'samplerate:200000'; ...

Using cellfun and regexp question

I think this does what you want. storedSamplerates{1} = 'SAMPLERATE: 50000'; storedSamplerates{2} = 'samplerate:200000'; ...

11 dagen ago | 0

| accepted

Answered

select random numbers from a group

I think I understand at least part of your question. Do you have the Statistics and Machine Learning Toolbox? If so, then to se...

select random numbers from a group

I think I understand at least part of your question. Do you have the Statistics and Machine Learning Toolbox? If so, then to se...

12 dagen ago | 0

Answered

error in multiplication of array by a number

Just a guess here. If you have x = [0.2204 0.1897] and then type 1000*x in the command window, it will display [220.4 189.7]...

error in multiplication of array by a number

Just a guess here. If you have x = [0.2204 0.1897] and then type 1000*x in the command window, it will display [220.4 189.7]...

14 dagen ago | 0

Answered

Take mean value when elements inside array "clump up"

Assuming that my guess about the correct output is correct, then the following should work. % Original (sorted) data a = [1; 1...

Take mean value when elements inside array "clump up"

Assuming that my guess about the correct output is correct, then the following should work. % Original (sorted) data a = [1; 1...

14 dagen ago | 0

| accepted

Answered

Running code and getting error about vector must be the same length

It's the subtle difference between these two lines of code: xAK_val = [xAK-.5, xAK + .5, xAK + .5, xAK -.5]; yAK_val = [yAK-.5...

Running code and getting error about vector must be the same length

It's the subtle difference between these two lines of code: xAK_val = [xAK-.5, xAK + .5, xAK + .5, xAK -.5]; yAK_val = [yAK-.5...

15 dagen ago | 1

| accepted

Answered

Why is Matlab 2019B not using python 3.6?

The following worked for me, per instructions in the documentation for pyenv. First, I ran pyenv with no argument, which told...

Why is Matlab 2019B not using python 3.6?

The following worked for me, per instructions in the documentation for pyenv. First, I ran pyenv with no argument, which told...

22 dagen ago | 0

Answered

Rectangular matrix manipulation with triu and tril

This will use the largest square matrix from the bottom right corner, as input to triu: d = min(size(A))-1; triu(A(end-d:end,e...

Rectangular matrix manipulation with triu and tril

This will use the largest square matrix from the bottom right corner, as input to triu: d = min(size(A))-1; triu(A(end-d:end,e...

23 dagen ago | 1

Answered

Creating subvectors from a vector

reshape(X,[],4) See the documentation for reshape for details. The empty square brackets there indicate that MATLAB should infe...

Creating subvectors from a vector

reshape(X,[],4) See the documentation for reshape for details. The empty square brackets there indicate that MATLAB should infe...

24 dagen ago | 1

| accepted

Answered

How to convert a cell to matrix?

Here is one straightforward way: % Original data A={[1 3 4]; [2 5 6 4]; [2 6 8 9 5 6]; [3 6 5 4 1]}; %%%%%% Con...

How to convert a cell to matrix?

Here is one straightforward way: % Original data A={[1 3 4]; [2 5 6 4]; [2 6 8 9 5 6]; [3 6 5 4 1]}; %%%%%% Con...

25 dagen ago | 1

Answered

How to change two variables in one loop?

There are many things about your question that I don't fully understand. The least important is whether you meant the loop to go...

How to change two variables in one loop?

There are many things about your question that I don't fully understand. The least important is whether you meant the loop to go...

28 dagen ago | 0

Answered

Error using cd, Cannot CD

This code works for me when mfilename is a file that exists in my path, but otherwise it gives that error. So, my guess is that ...

Error using cd, Cannot CD

This code works for me when mfilename is a file that exists in my path, but otherwise it gives that error. So, my guess is that ...

29 dagen ago | 0

| accepted

Answered

Add new row to String Array.

You can preallocate memory for the entire string array with str = strings(200000,1); and then fill row-by-row rather than appe...

Add new row to String Array.

You can preallocate memory for the entire string array with str = strings(200000,1); and then fill row-by-row rather than appe...

29 dagen ago | 1

| accepted

Answered

connect matlab to the cloud

Did you try to google "matlab amazon azure"? When I did, this link about using MATLAB in the Cloud was the first hit, and it has...

connect matlab to the cloud

Did you try to google "matlab amazon azure"? When I did, this link about using MATLAB in the Cloud was the first hit, and it has...

29 dagen ago | 0

Answered

Difference between errorbar and errorbarxy (function)

See this example from the documentation for errorbar.

Difference between errorbar and errorbarxy (function)

See this example from the documentation for errorbar.

ongeveer een maand ago | 0

| accepted

Answered

Creating Global Stiffness matrix

If I've understood correctly, then K = zeros(8); vec1 = [1 2 3 4 7 8]; K(vec1,vec1) = K(vec1,vec1) + k1; vec2 = [5 6 7 8...

Creating Global Stiffness matrix

If I've understood correctly, then K = zeros(8); vec1 = [1 2 3 4 7 8]; K(vec1,vec1) = K(vec1,vec1) + k1; vec2 = [5 6 7 8...

ongeveer een maand ago | 1

Answered

Average of a column without including a certain number

There is no specific function for this, but it is easy to do without a loop: A = [6; 3; 6; 4]; N = 6; mean_A_without_N = mean...

Average of a column without including a certain number

There is no specific function for this, but it is easy to do without a loop: A = [6; 3; 6; 4]; N = 6; mean_A_without_N = mean...

ongeveer een maand ago | 1

Answered

customize legend: extra legend entry

"The first item doesn't belong to any graph" immediately indicates to me that this text does not belong in the legend, for two r...

customize legend: extra legend entry

"The first item doesn't belong to any graph" immediately indicates to me that this text does not belong in the legend, for two r...

ongeveer een maand ago | 0

| accepted

Answered

How to set "dbstop if error" only to stop in my code

I don't think that that is possible. Are you aware of the "function stack" capability in the user interface? I show a screensho...

How to set "dbstop if error" only to stop in my code

I don't think that that is possible. Are you aware of the "function stack" capability in the user interface? I show a screensho...

ongeveer een maand ago | 0

| accepted

Answered

Repeated Measures ANOVA Matlab

If you have the Statistics and Machine Learning Toolbox, you can use the anovan function. In particular it looks like this examp...

Repeated Measures ANOVA Matlab

If you have the Statistics and Machine Learning Toolbox, you can use the anovan function. In particular it looks like this examp...

ongeveer een maand ago | 0

Answered

How do I calculate percentage or frequency and display it on a bar plot?

Because you have the typo rate=(frequency/total):100; instead of rate=(frequency/total)*100;

How do I calculate percentage or frequency and display it on a bar plot?

Because you have the typo rate=(frequency/total):100; instead of rate=(frequency/total)*100;

ongeveer een maand ago | 0

Answered

Symbols instead of line with plot

It looks like it might be because k_ is only a single value, the last one of the loop. Maybe you wanted k_(i) = k; in the lo...

Symbols instead of line with plot

It looks like it might be because k_ is only a single value, the last one of the loop. Maybe you wanted k_(i) = k; in the lo...

ongeveer een maand ago | 0

Answered

Help Using readmatrix or readcell

According to the documentation, there is no two-output syntax for the readmatrix command. You'll need to get a deeper understand...

Help Using readmatrix or readcell

According to the documentation, there is no two-output syntax for the readmatrix command. You'll need to get a deeper understand...

ongeveer een maand ago | 0

| accepted

Answered

How to process multiple Excel files using the same Matlab code for each

If you can make a cell array of the filenames, eg. filenames = {'this file.csv','that file.csv','oh this file too.csv'} then y...

How to process multiple Excel files using the same Matlab code for each

If you can make a cell array of the filenames, eg. filenames = {'this file.csv','that file.csv','oh this file too.csv'} then y...

ongeveer een maand ago | 0

| accepted

Answered

Index exceed number of array elements(1)

In your function, the input is a character array, but you convert it to a string. The expression Testdate(7:10) would have pul...

Index exceed number of array elements(1)

In your function, the input is a character array, but you convert it to a string. The expression Testdate(7:10) would have pul...

ongeveer een maand ago | 0

| accepted

Answered

How can I set the y tick interval (to powers of 10) on a log scale?

Like this? N = 500; x = sort(1e3*rand(N,1)); y = sort(1e6*rand(N,1)); figure loglog(x,y) set(gca,'XLim',[1e1 1e4],'XTick...

How can I set the y tick interval (to powers of 10) on a log scale?

Like this? N = 500; x = sort(1e3*rand(N,1)); y = sort(1e6*rand(N,1)); figure loglog(x,y) set(gca,'XLim',[1e1 1e4],'XTick...

ongeveer een maand ago | 0

| accepted

Answered

Is it possible to set the size of the gap between grouped bars in a bar graph?

Another option would be to abandon using grouped bars in a single call to bar(), and instead plot the two sets of bars with two ...

Is it possible to set the size of the gap between grouped bars in a bar graph?

Another option would be to abandon using grouped bars in a single call to bar(), and instead plot the two sets of bars with two ...

ongeveer een maand ago | 0

| accepted

Answered

Is it possible to set the size of the gap between grouped bars in a bar graph?

This question and the answer from MATLAB staff suggest that it is not possible using the built-in bar function. However, there ...

Is it possible to set the size of the gap between grouped bars in a bar graph?

This question and the answer from MATLAB staff suggest that it is not possible using the built-in bar function. However, there ...

ongeveer een maand ago | 0

Answered

How to plot a line over a specific interval?

Can you upload the data? Specifically, it is unclear to me what sort of data type g is. Instead of plotting x, you'll want to d...

How to plot a line over a specific interval?

Can you upload the data? Specifically, it is unclear to me what sort of data type g is. Instead of plotting x, you'll want to d...

ongeveer een maand ago | 0

| accepted