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

shuffle indexes when sorting matrix

One way that springs to mind is to add a small, random "jitter" to the values in the image. The jitter magnitude should be small...

shuffle indexes when sorting matrix

One way that springs to mind is to add a small, random "jitter" to the values in the image. The jitter magnitude should be small...

13 hours ago | 1

| accepted

Answered

How to suppress this error?

Two thoughts: First: Are you certain you have the correct warning? After you run your code that gives the warning, what is the ...

How to suppress this error?

Two thoughts: First: Are you certain you have the correct warning? After you run your code that gives the warning, what is the ...

17 hours ago | 0

Answered

Dot indexing is not supported for variables of this type???

Complete guess here. Are you simply trying to multiply the two variables? If so, then E(i).*tx(rr-1) Just using a dot, by itse...

Dot indexing is not supported for variables of this type???

Complete guess here. Are you simply trying to multiply the two variables? If so, then E(i).*tx(rr-1) Just using a dot, by itse...

1 day ago | 0

Answered

How to interpret entries in documentation's left pane

In that left-hand pane, the following pages are at the same "level of the documentation hierarchy": Get Started with MATLAB Com...

How to interpret entries in documentation's left pane

In that left-hand pane, the following pages are at the same "level of the documentation hierarchy": Get Started with MATLAB Com...

2 days ago | 1

Answered

Probability of Combinations Occurring

By "unique combinations", I assume you mean unique rows. Here is one way: % Example dataset. (Use your data instead.) x = [7 ...

Probability of Combinations Occurring

By "unique combinations", I assume you mean unique rows. Here is one way: % Example dataset. (Use your data instead.) x = [7 ...

2 days ago | 0

Answered

multiplying scalar by matrix

In the exponentials, you missed an important set of parentheses, ensuring that you divide by the whole expression (lambda .* k ...

multiplying scalar by matrix

In the exponentials, you missed an important set of parentheses, ensuring that you divide by the whole expression (lambda .* k ...

3 days ago | 0

| accepted

Answered

How can i create a for loop that modifies a column in an existing matrix?

I would use the histcounts command to do this task: A = [1,1,3,4,5,1]; dicevalue = [1,2,3,4,5,6]'; throwCounts = histcounts...

How can i create a for loop that modifies a column in an existing matrix?

I would use the histcounts command to do this task: A = [1,1,3,4,5,1]; dicevalue = [1,2,3,4,5,6]'; throwCounts = histcounts...

4 days ago | 0

| accepted

Answered

Question about writing a function.

In the future, you might want to separate two such different questions as two different posts here. For your first question, wh...

Question about writing a function.

In the future, you might want to separate two such different questions as two different posts here. For your first question, wh...

4 days ago | 0

| accepted

Answered

How to same size of plot and histogram

I think that using h1= histogram(data2p,'Normalization','pdf'); h2= histogram(data3p,'Normalization','pdf'); and of course r...

How to same size of plot and histogram

I think that using h1= histogram(data2p,'Normalization','pdf'); h2= histogram(data3p,'Normalization','pdf'); and of course r...

4 days ago | 1

| accepted

Answered

draw a boxplot from a probability density function

Here is a very kludgy way to do it. You can generate a small "sample" dataset that has the same summary statistics as your PDF, ...

draw a boxplot from a probability density function

Here is a very kludgy way to do it. You can generate a small "sample" dataset that has the same summary statistics as your PDF, ...

5 days ago | 0

Answered

Delete overlaping intervals in matrix

I expect there is a more elegant approach, but here is a straightforward way: M = [100 200 5; 150 210 7; 205 300 9;...

Delete overlaping intervals in matrix

I expect there is a more elegant approach, but here is a straightforward way: M = [100 200 5; 150 210 7; 205 300 9;...

8 days ago | 0

| accepted

Answered

Delete overlaping intervals in matrix

I believe this does what you want: M = [100 200; 150 210; 190 300; 300 400; 410 600; 500 700]; keepRow = M(2:end,1) >= M(1:end...

Delete overlaping intervals in matrix

I believe this does what you want: M = [100 200; 150 210; 190 300; 300 400; 410 600; 500 700]; keepRow = M(2:end,1) >= M(1:end...

9 days ago | 1

Answered

I want to use the Python libraries in MATLAB

Have you seen this documentation on calling python modules from MATLAB?

I want to use the Python libraries in MATLAB

Have you seen this documentation on calling python modules from MATLAB?

9 days ago | 0

Answered

how can I put the histfit function in terms of probability?

Here's one way: % Made-up data data = randn(500,1); % Fit to a normal (or a different distribution if you choose) pd = fit...

how can I put the histfit function in terms of probability?

Here's one way: % Made-up data data = randn(500,1); % Fit to a normal (or a different distribution if you choose) pd = fit...

10 days ago | 0

Answered

help with error "Reference to a cleared variable n"

Putting clear all inside the function clears the variable n that you just sent into it. You don't need that line.

help with error "Reference to a cleared variable n"

Putting clear all inside the function clears the variable n that you just sent into it. You don't need that line.

10 days ago | 0

| accepted

Answered

Using regexp to extract day number from long string

Is the directory depth reliably constant? If so, then % Input data str = 'folder\files and things\1996\other folder\ 6 <month>...

Using regexp to extract day number from long string

Is the directory depth reliably constant? If so, then % Input data str = 'folder\files and things\1996\other folder\ 6 <month>...

11 days ago | 0

Answered

Limiting the values of a column

If you mean that y is a column vector, then y_new = y((y>=-10) & (y<=10)) will give you a new column vector with only the valu...

Limiting the values of a column

If you mean that y is a column vector, then y_new = y((y>=-10) & (y<=10)) will give you a new column vector with only the valu...

11 days ago | 0

| accepted

Answered

Need help fitting given data to an exponential function

If you have the Statistics and Machine Learning Toolbox, you might be able to use the expfit function. If not, and you don't ha...

Need help fitting given data to an exponential function

If you have the Statistics and Machine Learning Toolbox, you might be able to use the expfit function. If not, and you don't ha...

13 days ago | 0

Answered

How to search for an exact string not just contains

Use strcmp instead, which checks for identical matches. loc = {'Las Vegas, NV','North Las Vegas, NV'}; match = strcmp(loc,'L...

How to search for an exact string not just contains

Use strcmp instead, which checks for identical matches. loc = {'Las Vegas, NV','North Las Vegas, NV'}; match = strcmp(loc,'L...

14 days ago | 0

Answered

Counting every other number in a list

I'm not sure what you mean by "count" them, but the following vector will store every other element from mylist, starting with t...

Counting every other number in a list

I'm not sure what you mean by "count" them, but the following vector will store every other element from mylist, starting with t...

14 days ago | 0

| accepted

Answered

gaussian plot on my histogram

If you have the Statistics and Machine Learning Toolbox, you can use the histfit function to do the histogram and gaussian fit a...

gaussian plot on my histogram

If you have the Statistics and Machine Learning Toolbox, you can use the histfit function to do the histogram and gaussian fit a...

17 days ago | 0

Answered

Who is using the MATLAB Discord channel?

This is the first I've heard of MATLAB having a Discord channel

Who is using the MATLAB Discord channel?

This is the first I've heard of MATLAB having a Discord channel

18 days ago | 1

Answered

Get size of each element in a cell

You can use the cellfun command: cellfun(@size,myCell,'UniformOutput',false)

Get size of each element in a cell

You can use the cellfun command: cellfun(@size,myCell,'UniformOutput',false)

19 days ago | 1

| accepted

Answered

How to interpret PCA

@Jin Woo: If search this forum for cyclist and pca, you will find a few question/answers where I explain a lot about the interp...

How to interpret PCA

@Jin Woo: If search this forum for cyclist and pca, you will find a few question/answers where I explain a lot about the interp...

19 days ago | 0

Answered

Numbering results from for loop with the iteration they come from

Don't use separate variable names. Use the cell array data type: K{i} = ( ( EALtheta(i,1) * EALtheta(i,2) ) / EALtheta(i,3) )*...

Numbering results from for loop with the iteration they come from

Don't use separate variable names. Use the cell array data type: K{i} = ( ( EALtheta(i,1) * EALtheta(i,2) ) / EALtheta(i,3) )*...

20 days ago | 0

Answered

Array indices must be positive integers or logical values.

It seems that you have tried to use this line of code: funcnew01=z^5+z^3-pi; to define a general function on z. Then you try t...

Array indices must be positive integers or logical values.

It seems that you have tried to use this line of code: funcnew01=z^5+z^3-pi; to define a general function on z. Then you try t...

20 days ago | 1

| accepted

Answered

Compute the summation of all elements square of matrix

This looks like homework. In the future, please listen to James Tursa's advice, and post what you have tried, be specific about...

Compute the summation of all elements square of matrix

This looks like homework. In the future, please listen to James Tursa's advice, and post what you have tried, be specific about...

21 days ago | 0

Answered

Why is the (second) if statement in the for loop not working?

I don't know if this is perfectly correct, but it is certainly closer: Where you have i_Last(i) = Faktor*(i_0+(i_Amp*(1-exp(-(...

Why is the (second) if statement in the for loop not working?

I don't know if this is perfectly correct, but it is certainly closer: Where you have i_Last(i) = Faktor*(i_0+(i_Amp*(1-exp(-(...

25 days ago | 0

| accepted

Answered

How can I extract numbers from a column in a matrix dependent on a number in another column ?

If your matrix is A, then output = log(A(A(:,4)==2,9)); In case it is not obvious what that one line of code is going, work fr...

How can I extract numbers from a column in a matrix dependent on a number in another column ?

If your matrix is A, then output = log(A(A(:,4)==2,9)); In case it is not obvious what that one line of code is going, work fr...

26 days ago | 1

| accepted

Answered

Different machine precision for scalars and vectors?

If you don't have a specific reason to be using a for loop here, why not also teach them canonical use of vectorized calculation...

Different machine precision for scalars and vectors?

If you don't have a specific reason to be using a for loop here, why not also teach them canonical use of vectorized calculation...

26 days ago | 1