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 insert a degree symbol in matlab using input function?

['temperature is 25',char(176),'C']

How to insert a degree symbol in matlab using input function?

['temperature is 25',char(176),'C']

alrededor de 10 horas ago | 0

Answered

Count vector position in a matrix

Here's one way: tmp = cumsum(sum(A~=0,2)) rowptr = [1; tmp(1:end-1)+1];

Count vector position in a matrix

Here's one way: tmp = cumsum(sum(A~=0,2)) rowptr = [1; tmp(1:end-1)+1];

alrededor de 11 horas ago | 0

Answered

Counting the number of occurences of a specific (defined) sequence within a vector

I would download the excellent RunLength utility from the File Exchange, and then ... d = diff(vector)>0; [isInc,runLenTmp,s...

Counting the number of occurences of a specific (defined) sequence within a vector

I would download the excellent RunLength utility from the File Exchange, and then ... d = diff(vector)>0; [isInc,runLenTmp,s...

alrededor de 11 horas ago | 0

| accepted

Answered

Create a matrix with multiple values at each element and apply a function to all?

Here is one way: [XXs,YYs] = meshgrid(Xs,Ys); fxy = f(XXs,YYs);

Create a matrix with multiple values at each element and apply a function to all?

Here is one way: [XXs,YYs] = meshgrid(Xs,Ys); fxy = f(XXs,YYs);

alrededor de 16 horas ago | 0

Answered

confronting cell with abelians (logic values)

Here is one way: C = A; C(~B) = {'0'};

confronting cell with abelians (logic values)

Here is one way: C = A; C(~B) = {'0'};

1 día ago | 0

| accepted

Answered

plot a function having two variables with unequal elements

Merging the code you've provided with Walter's comments: pitch=[30 40 50 60 70]' ; L=linspace(1,1000); delta1 = 1; W1 = 1;...

plot a function having two variables with unequal elements

Merging the code you've provided with Walter's comments: pitch=[30 40 50 60 70]' ; L=linspace(1,1000); delta1 = 1; W1 = 1;...

3 días ago | 0

Answered

The code behind rectangular command

It's doing what is described in the documentation for the rectangle function. Hint: There is a line function in MATLAB.

The code behind rectangular command

It's doing what is described in the documentation for the rectangle function. Hint: There is a line function in MATLAB.

3 días ago | 0

Answered

calculating the mean of specific array using previous & next array

The variable outliers contains the indices to the outlier locations, right? Then W(outliers) = (W(outliers-1) + W(outliers+1))/...

calculating the mean of specific array using previous & next array

The variable outliers contains the indices to the outlier locations, right? Then W(outliers) = (W(outliers-1) + W(outliers+1))/...

4 días ago | 0

| accepted

Answered

I keep on getting this error when I try to turn my given data into a graph

A=importdata('mariana_depth.csv'); lon=importdata('mariana_longitude.csv'); lat=importdata('mariana_latitude.csv'); [lat_...

I keep on getting this error when I try to turn my given data into a graph

A=importdata('mariana_depth.csv'); lon=importdata('mariana_longitude.csv'); lat=importdata('mariana_latitude.csv'); [lat_...

5 días ago | 0

| accepted

Answered

I keep on getting this error when I try to turn my given data into a graph

I can guess at a couple problems here, and I'm also going to guess that you didn't really study the documentation for surfc, to ...

I keep on getting this error when I try to turn my given data into a graph

I can guess at a couple problems here, and I'm also going to guess that you didn't really study the documentation for surfc, to ...

5 días ago | 0

Answered

Sort a matrix based on unique values

I think you can use the ismember function to do what you want. For example, [tf,loc] = ismember([1001 1002 1004],[1001 1002 100...

Sort a matrix based on unique values

I think you can use the ismember function to do what you want. For example, [tf,loc] = ismember([1001 1002 1004],[1001 1002 100...

6 días ago | 1

| accepted

Answered

How can I improve the performance of my code? Specifically with the randn function for large arrays in a Monte Carlo simulation.

I did not try to run your code, but did some independent testing. I ran in chunks of 1e6, which seemed empirically seemed about...

How can I improve the performance of my code? Specifically with the randn function for large arrays in a Monte Carlo simulation.

I did not try to run your code, but did some independent testing. I ran in chunks of 1e6, which seemed empirically seemed about...

6 días ago | 1

| accepted

Answered

How to located a point on top, in between and below two curves.

You should be able to use the inpolygon function to solve this.

How to located a point on top, in between and below two curves.

You should be able to use the inpolygon function to solve this.

7 días ago | 1

| accepted

Answered

Error in using rmoutliers()

Running this load FORCHECK.mat FFF = rmoutliers(FORCHECK,'percentiles',[0 90]); worked just fine for me. Maybe just restar...

Error in using rmoutliers()

Running this load FORCHECK.mat FFF = rmoutliers(FORCHECK,'percentiles',[0 90]); worked just fine for me. Maybe just restar...

9 días ago | 1

Answered

Creating a matrix from spaced out lines of another matrix

Here is a function definition. Put it in a file named smallFromBig.m. function [xyzSmall] = smallFromBig(x,y,xyzBig) ...

Creating a matrix from spaced out lines of another matrix

Here is a function definition. Put it in a file named smallFromBig.m. function [xyzSmall] = smallFromBig(x,y,xyzBig) ...

9 días ago | 0

| accepted

Answered

How to obtain eigenvalues as functions of a variable?

Take a look at John D'Errico's eigenshuffle function in the File Exchange. I believe it does what you want (and there is some th...

How to obtain eigenvalues as functions of a variable?

Take a look at John D'Errico's eigenshuffle function in the File Exchange. I believe it does what you want (and there is some th...

9 días ago | 0

| accepted

Answered

Plotting a function with two terms or alternatively a curve of best fit to a histogram

If you have all of the x values, then you should be able to fit using the fitgmdist function, which will find the best fit to mu...

Plotting a function with two terms or alternatively a curve of best fit to a histogram

If you have all of the x values, then you should be able to fit using the fitgmdist function, which will find the best fit to mu...

9 días ago | 1

Answered

Converting input matrix A with size 4x3 into B matrix with size 12x3 with coordinates in matrix A

Here is a somewhat slick way: [m,n] = size(A); AA = A'; B = [repelem(1:m,n)' mod(0:m*n-1,n)'+1 AA(:)]; This is fine if one...

Converting input matrix A with size 4x3 into B matrix with size 12x3 with coordinates in matrix A

Here is a somewhat slick way: [m,n] = size(A); AA = A'; B = [repelem(1:m,n)' mod(0:m*n-1,n)'+1 AA(:)]; This is fine if one...

10 días ago | 0

Answered

Converting input matrix A with size 4x3 into B matrix with size 12x3 with coordinates in matrix A

There are some slicker ways to do this, but it might be instructive for you to see how to do this with a simple for loop: [m,n]...

Converting input matrix A with size 4x3 into B matrix with size 12x3 with coordinates in matrix A

There are some slicker ways to do this, but it might be instructive for you to see how to do this with a simple for loop: [m,n]...

10 días ago | 0

| accepted

Answered

determining linear independence among two vectors using least square method

If you have the Statistics and Machine Learning Toolbox, then you can use the fitlm function.

determining linear independence among two vectors using least square method

If you have the Statistics and Machine Learning Toolbox, then you can use the fitlm function.

10 días ago | 0

Answered

determining linear independence among two vectors using least square method

If your two vectors are v1 and v2, then you could use the corrcoef function to calculate the correlation coefficient and its p-v...

determining linear independence among two vectors using least square method

If your two vectors are v1 and v2, then you could use the corrcoef function to calculate the correlation coefficient and its p-v...

10 días ago | 0

Answered

Find indexes according to a value in array

Dare I say obviously, A can't obey both the conditions simultaneously. You need to find the indices separately. [find(A<=x,1,'l...

Find indexes according to a value in array

Dare I say obviously, A can't obey both the conditions simultaneously. You need to find the indices separately. [find(A<=x,1,'l...

11 días ago | 0

| accepted

Answered

error while using Operands

Here's what is means: true && true; % This works, and gives a scalar result [true true] && [true false]; % This gives the er...

error while using Operands

Here's what is means: true && true; % This works, and gives a scalar result [true true] && [true false]; % This gives the er...

12 días ago | 0

Answered

How to correct matrix dimension disagree error

You are effectively trying to do this operation in your code: n * u where n is a 1x4 matrix, and u is a 1x100 matrix. That wo...

How to correct matrix dimension disagree error

You are effectively trying to do this operation in your code: n * u where n is a 1x4 matrix, and u is a 1x100 matrix. That wo...

13 días ago | 0

Answered

Select specific cells from a cell array and create a seperate vector

Does your cell array have only numeric values in it? If yes, then maxVal = max(cell2num(C),[],3) where C is your cell array.

Select specific cells from a cell array and create a seperate vector

Does your cell array have only numeric values in it? If yes, then maxVal = max(cell2num(C),[],3) where C is your cell array.

13 días ago | 0

| accepted

Answered

How to create a plot of the spread of the data

Does using subplots help show your point better? % Load the data load Data1.mat % Convert from table to numeric Data = tab...

How to create a plot of the spread of the data

Does using subplots help show your point better? % Load the data load Data1.mat % Convert from table to numeric Data = tab...

13 días ago | 0

| accepted

Solved

Say something funny

Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

13 días ago

Answered

set default line marker symbol

See this answer from Mathworks support.

set default line marker symbol

See this answer from Mathworks support.

13 días ago | 1

| accepted

Answered

how to find the Reverse process of A(B).

C = [9 4 2 1 7 6 8 5 3 8 11]; A(B) = C

how to find the Reverse process of A(B).

C = [9 4 2 1 7 6 8 5 3 8 11]; A(B) = C

14 días ago | 1

Answered

How do I find the column of maximum values of a maxtrix?

Here is one way to do it. [~,linearIndex] = max(x,[],'all','linear'); % First, find the *linear* index of x [rowIndex,colIndex...

How do I find the column of maximum values of a maxtrix?

Here is one way to do it. [~,linearIndex] = max(x,[],'all','linear'); % First, find the *linear* index of x [rowIndex,colIndex...

14 días ago | 0