Email: feel free to contact me regarding my shared files on the file exchange. I don't do free consulting outside of the forum so if you have a Matlab question, post the question to the forum and you may email me the link to the question.

About me: Finishing PhD soon on topics related to vision science; neurophysiology; sensory-motor feedback and control; control systems; steering & navigation; multisensory integration; top-down bottom-up feedback loop.

"If I had only one hour to save the world, I would spend fifty-five minutes defining the problem, and only five minutes finding the solution." -Albert Einstein

"An expert is a person who has made all the mistakes that can be made in a very narrow field." -Niels Bohr

"If you are not embarrassed by the first version of your product, you've launched too late" - Reid Hoffman

Answered

Interp3. Error using griddedInterpolant. The grid vectors do not define a grid of points that match the given values.

Follow this tutorial and if you get stuck or come across a problem that isn't already addressed in the forum I'd be glad to dig ...

Interp3. Error using griddedInterpolant. The grid vectors do not define a grid of points that match the given values.

Follow this tutorial and if you get stuck or come across a problem that isn't already addressed in the forum I'd be glad to dig ...

14 hours ago | 0

Answered

how to create a .txt file from char vector using matlab?

T=['x=2;',newline,'y=3;',newline,'z=x*y;']; filename = 'myTextFile.txt'; % better to use fullfile(path,name) fid = fopen(...

how to create a .txt file from char vector using matlab?

T=['x=2;',newline,'y=3;',newline,'z=x*y;']; filename = 'myTextFile.txt'; % better to use fullfile(path,name) fid = fopen(...

14 hours ago | 0

| accepted

Answered

Cross-correlation questions

Perhaps working through one of the examples in the xcorr documentation would be helpful. https://www.mathworks.com/help/matlab...

Cross-correlation questions

Perhaps working through one of the examples in the xcorr documentation would be helpful. https://www.mathworks.com/help/matlab...

19 hours ago | 0

| accepted

Answered

How do I add a for loop to do subplots

The general template to build subplots within a loop nrows = 2; % number of subplot rows ncols = 1; % number of subplot column...

How do I add a for loop to do subplots

The general template to build subplots within a loop nrows = 2; % number of subplot rows ncols = 1; % number of subplot column...

1 day ago | 1

| accepted

Answered

how to add a label to a specific point on a fplot

This command will add a text label with a leftward arrow pointing to the coordinates text(0.5607, 0, '\leftarrow My Favorite Po...

how to add a label to a specific point on a fplot

This command will add a text label with a leftward arrow pointing to the coordinates text(0.5607, 0, '\leftarrow My Favorite Po...

1 day ago | 0

| accepted

Answered

Create Error bar and title into the bar chart

Here's a simple demo you can follow to add errorbars to your bar plot. https://www.mathworks.com/matlabcentral/answers/420926-...

Create Error bar and title into the bar chart

Here's a simple demo you can follow to add errorbars to your bar plot. https://www.mathworks.com/matlabcentral/answers/420926-...

1 day ago | 0

Answered

getting a NaN in correlation coefficient

Notice that all of the values in y are identical y=[-0.414; -0.414; -0.414]; If you look at the equations for corr2() or Pe...

getting a NaN in correlation coefficient

Notice that all of the values in y are identical y=[-0.414; -0.414; -0.414]; If you look at the equations for corr2() or Pe...

1 day ago | 1

| accepted

Question

Dealing with flags that are really comments

I've noticed an increase in the number of flagged answers/questions/comments in the forum from less active users treating flags ...

1 day ago | 1 answer | 0

Answered

Average values from timeseries

Below is a general scetch of what you need to do. Give it a shot and if you get stuck, share the code and let us know where you...

Average values from timeseries

Below is a general scetch of what you need to do. Give it a shot and if you get stuck, share the code and let us know where you...

1 day ago | 0

| accepted

Answered

Bar chart legend and colour

There are two approaches below. I recommend using the first one where the bars and labeled by the xtick labels. You can rotate...

Bar chart legend and colour

There are two approaches below. I recommend using the first one where the bars and labeled by the xtick labels. You can rotate...

1 day ago | 0

| accepted

Answered

How can I create a 3D plot of data with dots of different color?

Use scatter3() to create the 3D scatter plot and scale the colors based on a vector of mean values. % Create 100x3 matrix of [...

How can I create a 3D plot of data with dots of different color?

Use scatter3() to create the 3D scatter plot and scale the colors based on a vector of mean values. % Create 100x3 matrix of [...

1 day ago | 0

| accepted

Answered

shows table in gui panel

"Error using matlab.ui.control.Table/set; Functionality not supported with figures created with the figure function." handles.T...

shows table in gui panel

"Error using matlab.ui.control.Table/set; Functionality not supported with figures created with the figure function." handles.T...

3 days ago | 0

| accepted

Answered

how to know if a char vector contains unwanted characters?

Following the description from your question, here's an anonymous function allCharsGood() with two inputs, c is a 1xn char arr...

how to know if a char vector contains unwanted characters?

Following the description from your question, here's an anonymous function allCharsGood() with two inputs, c is a 1xn char arr...

3 days ago | 1

Answered

Scatter Plot with different "markers" and "data labels"

"I need a scatter plot with different markers" The scatter() function only allows one marker definition so the data are plotted...

Scatter Plot with different "markers" and "data labels"

"I need a scatter plot with different markers" The scatter() function only allows one marker definition so the data are plotted...

3 days ago | 0

| accepted

Answered

How do i select a point on matlab UIaxes and then get data for it?

The brush tool is not (yet?) available on UIAxes as of r2019b; neither is rbbox. Here's a workaround. The first block of code ...

How do i select a point on matlab UIaxes and then get data for it?

The brush tool is not (yet?) available on UIAxes as of r2019b; neither is rbbox. Here's a workaround. The first block of code ...

4 days ago | 0

| accepted

Answered

How can I automatically assign figure title in doubled for loop

Use sprintf() Example for lauf7 = [5 6 8 29 30] for lauf6 = 19:30 figure('name',sprintf('lauf7_%d_lauf6_%d',lauf...

How can I automatically assign figure title in doubled for loop

Use sprintf() Example for lauf7 = [5 6 8 29 30] for lauf6 = 19:30 figure('name',sprintf('lauf7_%d_lauf6_%d',lauf...

4 days ago | 1

| accepted

Answered

legend has same colors

Use the function outputs to get the line object handles. Then, use the object handles in legend(). sem1 = semilogy([1:101],rR...

legend has same colors

Use the function outputs to get the line object handles. Then, use the object handles in legend(). sem1 = semilogy([1:101],rR...

4 days ago | 0

| accepted

Answered

Find index of array of cell

If you want to delete the file names from the files array.... load('example.mat') select = strcmp(out, 'F'); files(select) = ...

Find index of array of cell

If you want to delete the file names from the files array.... load('example.mat') select = strcmp(out, 'F'); files(select) = ...

4 days ago | 0

| accepted

Answered

Find Second Closest Datetime

This is a slight modification from the answer in your previous question. It uses [B,I] = mink(A,k) to locate the k_th small...

Find Second Closest Datetime

This is a slight modification from the answer in your previous question. It uses [B,I] = mink(A,k) to locate the k_th small...

7 days ago | 0

| accepted

Answered

Finding nearest tables based on latitude and longitude columns

Inputs A is a 1xn or n1x cell array of tables; each table contains the headers 'lat' and 'lon' which are constants. B is a 1xm...

Finding nearest tables based on latitude and longitude columns

Inputs A is a 1xn or n1x cell array of tables; each table contains the headers 'lat' and 'lon' which are constants. B is a 1xm...

8 days ago | 1

| accepted

Answered

How to extract all the elements in a vector whose index is 1?

x = R(ranks == 2) Indexing is one of the most important tools in Matlab. This is a good resource to get you started. https:...

How to extract all the elements in a vector whose index is 1?

x = R(ranks == 2) Indexing is one of the most important tools in Matlab. This is a good resource to get you started. https:...

9 days ago | 0

Answered

how can i implement the Gaussian potential value code?

x is a vector of length n. I'm assuming sigma is std(x) phi = sum(exp(-(vecnorm(x(:)-x(:).',2,1) / std(x)).^2)); phi(i) is t...

how can i implement the Gaussian potential value code?

x is a vector of length n. I'm assuming sigma is std(x) phi = sum(exp(-(vecnorm(x(:)-x(:).',2,1) / std(x)).^2)); phi(i) is t...

9 days ago | 0

Answered

if statements, keep getting error can someone explain why?

if you open this file in the editor you'll see red markings indicating the lines that contains an error. The orange lines indic...

if statements, keep getting error can someone explain why?

if you open this file in the editor you'll see red markings indicating the lines that contains an error. The orange lines indic...

9 days ago | 0

Answered

Is it possible to set the position of a uialert within app designer?

"Is it possible to set the position of a uialert within app designer?" As of r2019b, no. Alternatives include using a msgb...

Is it possible to set the position of a uialert within app designer?

"Is it possible to set the position of a uialert within app designer?" As of r2019b, no. Alternatives include using a msgb...

9 days ago | 0

Answered

How to scatter plot a cell array

Input: data, an 18x1 cell array where each element is a 1xn double precision vector varying in size. Output: a figure with x...

How to scatter plot a cell array

Input: data, an 18x1 cell array where each element is a 1xn double precision vector varying in size. Output: a figure with x...

10 days ago | 0

| accepted

Answered

How to assign point to multiple circles

The first block of code below identifies which circle center is closest to each pts_positions using pdist2(). It then assigns t...

How to assign point to multiple circles

The first block of code below identifies which circle center is closest to each pts_positions using pdist2(). It then assigns t...

10 days ago | 0

| accepted

Answered

How do I relabel classes into one sub group?

load fisheriris idx = ~ismember(species, 'setosa'); species(idx) = {'abnormal'};

How do I relabel classes into one sub group?

load fisheriris idx = ~ismember(species, 'setosa'); species(idx) = {'abnormal'};

10 days ago | 1

| accepted

Answered

Audioread Impulse noise detection and removal of impulse signals

This uses findpeaks to locate the impuse signal in channel 2 of the wave file. Peaks are required to be at least 3 standard devi...

Audioread Impulse noise detection and removal of impulse signals

This uses findpeaks to locate the impuse signal in channel 2 of the wave file. Peaks are required to be at least 3 standard devi...

10 days ago | 0

| accepted

Answered

matlab gets different answers for the same code

Summary of comments under the question The two functions being compared aren't necessarily doing the same thing though, with so...

matlab gets different answers for the same code

Summary of comments under the question The two functions being compared aren't necessarily doing the same thing though, with so...

10 days ago | 0

| accepted

Answered

How to shade the area between the upper line and the lower line? thank you!

fliplr() flips the vector left to right. patch() plots the colored patch between the lines. x = [t, fliplr(t)]; % ...

How to shade the area between the upper line and the lower line? thank you!

fliplr() flips the vector left to right. patch() plots the colored patch between the lines. x = [t, fliplr(t)]; % ...

11 days ago | 0

| accepted