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

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...

1 jour 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 ...

2 jours ago | 0

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...

2 jours ago | 1

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...

2 jours 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.

9 jours 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...

10 jours 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...

10 jours 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...

11 jours 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...

11 jours 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...

12 jours 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;

12 jours 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...

12 jours 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...

12 jours 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...

12 jours 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...

12 jours 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...

15 jours 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 ...

15 jours 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 ...

15 jours 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...

15 jours ago | 0

| accepted

Answered

create a variable and specify its column

The specifics will depend on what format the variable day is. Here, I assume it is a datetime. % Create the table day = dateti...

create a variable and specify its column

The specifics will depend on what format the variable day is. Here, I assume it is a datetime. % Create the table day = dateti...

17 jours ago | 1

| accepted

Answered

sort boxplot based on 25-75th percentiles

Yes, it is possible. The algorithm would be something like Find the percentiles on the data, using the prctile command, before ...

sort boxplot based on 25-75th percentiles

Yes, it is possible. The algorithm would be something like Find the percentiles on the data, using the prctile command, before ...

17 jours ago | 0

| accepted

Answered

Index in position 1 exceeds array bounds (must not exceed 26)

You haven't provided enough info to run your code, which would make debugging much easier. You also didn't tell us which line gi...

Index in position 1 exceeds array bounds (must not exceed 26)

You haven't provided enough info to run your code, which would make debugging much easier. You also didn't tell us which line gi...

19 jours ago | 0

Answered

trying to use logical matrix to get remove some elements from matrix instead of getting a same matrix im getting a column matrix

Assuming you want zeros in the other locations: a=[1,2,3;12,21,2;2,1,2] b=(a>1) c = zeros(size(a)); c(b)=a(b) c = ...

trying to use logical matrix to get remove some elements from matrix instead of getting a same matrix im getting a column matrix

Assuming you want zeros in the other locations: a=[1,2,3;12,21,2;2,1,2] b=(a>1) c = zeros(size(a)); c(b)=a(b) c = ...

19 jours ago | 1

Answered

How to check what part of an array isn't scalar?

Just to clarify, are you saying that you have a categorical array, you are trying to apply the unique command to that array, and...

How to check what part of an array isn't scalar?

Just to clarify, are you saying that you have a categorical array, you are trying to apply the unique command to that array, and...

19 jours ago | 0

Answered

My output did not display in command windows when using script

The syntax you used, fprintf(fid,...) is explicitly for writing to files. Use fprintf(...) % without "fid" argument to write...

My output did not display in command windows when using script

The syntax you used, fprintf(fid,...) is explicitly for writing to files. Use fprintf(...) % without "fid" argument to write...

19 jours ago | 1

Answered

(Array indices must be positive integers or logical values.) any help plz

The specific reason you get that error is that sx is complex number. sx is complex because s is complex. s is complex because ...

(Array indices must be positive integers or logical values.) any help plz

The specific reason you get that error is that sx is complex number. sx is complex because s is complex. s is complex because ...

20 jours ago | 1

| accepted

Answered

How to change the plot title and file name when saving it to a for loop

Part of the problem is that you are mixing character arrays and strings. The following works (after you set your own outputdir):...

How to change the plot title and file name when saving it to a for loop

Part of the problem is that you are mixing character arrays and strings. The following works (after you set your own outputdir):...

20 jours ago | 1

| accepted

Answered

For loop to calculate distance between a 5d dimensional data point and another matrix

The distance from the i-th point of T to the j-th centroid is sqrt(sum((T(:,i) - centroids(:,j)).^2)); % Check my formula here,...

For loop to calculate distance between a 5d dimensional data point and another matrix

The distance from the i-th point of T to the j-th centroid is sqrt(sum((T(:,i) - centroids(:,j)).^2)); % Check my formula here,...

22 jours ago | 0

Answered

I have a variable with a string that I would like to use as a filename, how do I input that string into a function rather than the variable name?

I think I see the problem. Did you notice that the output of the inputdlg command is a cell array? You need the contents of that...

I have a variable with a string that I would like to use as a filename, how do I input that string into a function rather than the variable name?

I think I see the problem. Did you notice that the output of the inputdlg command is a cell array? You need the contents of that...

22 jours ago | 0

| accepted

Answered

array and logicals; deleting columns

Here is one way. arr = [1 2 3; 4 5 6; 7 8 9]; logic = [false true false]; new = arr(:,not(logic))

array and logicals; deleting columns

Here is one way. arr = [1 2 3; 4 5 6; 7 8 9]; logic = [false true false]; new = arr(:,not(logic))

23 jours ago | 0

| accepted