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

ttest NaN result is NaN and i am a beginner

Since this topic continues to surface within the forum, here's a summary of reasons why NaN values may appear in a ttest() outpu...

ttest NaN result is NaN and i am a beginner

Since this topic continues to surface within the forum, here's a summary of reasons why NaN values may appear in a ttest() outpu...

37 minutes ago | 1

Answered

Filling area with pattern

Hi shane, filling with a pattern isn't trivial so I recommend the functions listed in the file exchange. However, here's a fai...

Filling area with pattern

Hi shane, filling with a pattern isn't trivial so I recommend the functions listed in the file exchange. However, here's a fai...

1 hour ago | 0

Answered

Figure colorbar is not refreshed

Control the limits of the colorbar using caxis(). This line adjusts the colorbar limits to the range of your data. caxis([min...

Figure colorbar is not refreshed

Control the limits of the colorbar using caxis(). This line adjusts the colorbar limits to the range of your data. caxis([min...

2 hours ago | 0

Answered

get the location of points in a plot by mouse interaction in app designer

That call back function uses fprintf() to display the results in the command window. To display the results as text in a textbox...

get the location of points in a plot by mouse interaction in app designer

That call back function uses fprintf() to display the results in the command window. To display the results as text in a textbox...

2 hours ago | 0

Answered

Why do I get an NaN error with the ttest?

Rather than copying the answer to here, see this review of possible causes of NaN output in ttest().

Why do I get an NaN error with the ttest?

Rather than copying the answer to here, see this review of possible causes of NaN output in ttest().

2 hours ago | 0

Answered

Matlab considers different two equal numbers!

You could limit the values in your matrix to the first 4 decimal places but this is usually not a good idea unles there's a reas...

Matlab considers different two equal numbers!

You could limit the values in your matrix to the first 4 decimal places but this is usually not a good idea unles there's a reas...

5 hours ago | 1

Answered

How can I find the parcentage of values in a vector that are bigger than 5.

" I want to calculate the number of values in that vector that are bigger than 5" p = sum(v>5)/numel(v); If there are NaNs yo...

How can I find the parcentage of values in a vector that are bigger than 5.

" I want to calculate the number of values in that vector that are bigger than 5" p = sum(v>5)/numel(v); If there are NaNs yo...

8 hours ago | 0

Answered

Why am I getting "Array indices must be positive integers or logical values"?

This line below implies that you're trying to index values from an array N where the index values must be positive integers or l...

Why am I getting "Array indices must be positive integers or logical values"?

This line below implies that you're trying to index values from an array N where the index values must be positive integers or l...

8 hours ago | 1

Answered

Correct way to detect Zero crossing

The entire function can be replaced with y = I<1e-8; which will return a logical (true | false). If you want a double (1 | ...

Correct way to detect Zero crossing

The entire function can be replaced with y = I<1e-8; which will return a logical (true | false). If you want a double (1 | ...

8 hours ago | 0

Answered

How to create 2D sub arrays by sampling every n by n points

The iter-loop is completely unnecessary and is merely doing the same exact work 1000 times. numIter=1000; tic % for iter=1:n...

How to create 2D sub arrays by sampling every n by n points

The iter-loop is completely unnecessary and is merely doing the same exact work 1000 times. numIter=1000; tic % for iter=1:n...

8 hours ago | 0

Answered

How can I put a display that shows changing variables in a plot?

Use h=text(. . .) to create the text object and then update the handle as needed. Here's a demo clf() axh = axes(); h =...

How can I put a display that shows changing variables in a plot?

Use h=text(. . .) to create the text object and then update the handle as needed. Here's a demo clf() axh = axes(); h =...

17 hours ago | 0

Answered

Change bar colors based on date

The only place in your data where I see moon phase is in column F of your spreadsheet and only the first month is indicated. Th...

Change bar colors based on date

The only place in your data where I see moon phase is in column F of your spreadsheet and only the first month is indicated. Th...

17 hours ago | 0

| accepted

Answered

how expand plots with different x-axis ranges

Specify the edges for both histograms rather than letting that funciton choose the bins. histogram(X,edges) If the data fro...

how expand plots with different x-axis ranges

Specify the edges for both histograms rather than letting that funciton choose the bins. histogram(X,edges) If the data fro...

23 hours ago | 0

Answered

Resize plot to fit text

Get the extent of the text objects after plotting the text. Add the vertical position and height to get the upper position of ...

Resize plot to fit text

Get the extent of the text objects after plotting the text. Add the vertical position and height to get the upper position of ...

1 day ago | 1

| accepted

Answered

Error using plot Vectors must be the same length.

The cross correlation function xcorr() will produce an output with 2*M-1 elements where M is the number of elements in the input...

Error using plot Vectors must be the same length.

The cross correlation function xcorr() will produce an output with 2*M-1 elements where M is the number of elements in the input...

1 day ago | 1

| accepted

Answered

Non linear least square fitting

Create noisy circular data This section creates the noisy data we're fitting. % Create randome points along a circle r = 22...

Non linear least square fitting

Create noisy circular data This section creates the noisy data we're fitting. % Create randome points along a circle r = 22...

1 day ago | 1

| accepted

Answered

How to read file .txt?

Assuming your text file is named myTextFile.txt and contains only that matrix, A = readmatrix('myTextFile.txt'); % for Matlab ...

How to read file .txt?

Assuming your text file is named myTextFile.txt and contains only that matrix, A = readmatrix('myTextFile.txt'); % for Matlab ...

1 day ago | 0

| accepted

Answered

How do I shade the xy plane at z=0 of my plot and how to stop the plot after it passes z=0?

The easiest solution is simply zlim([0,inf]) I also added grid on so we can see the 3D coordinates better. However, the data b...

How do I shade the xy plane at z=0 of my plot and how to stop the plot after it passes z=0?

The easiest solution is simply zlim([0,inf]) I also added grid on so we can see the 3D coordinates better. However, the data b...

1 day ago | 0

| accepted

Answered

How to display result in Text Area in Matlab Appdesigner

It's unclear whether you're working with numeric or text values. App designer has edit fields that return text and edit fields ...

How to display result in Text Area in Matlab Appdesigner

It's unclear whether you're working with numeric or text values. App designer has edit fields that return text and edit fields ...

1 day ago | 0

Answered

Print user-defined error messages as a table

msg = sprintf(['Polygon not supported. List of supported polygons is:\n' ... ' Triangle\n Square\n Pentagon\n Hexagon\n Hep...

Print user-defined error messages as a table

msg = sprintf(['Polygon not supported. List of supported polygons is:\n' ... ' Triangle\n Square\n Pentagon\n Hexagon\n Hep...

4 days ago | 0

| accepted

Answered

First cell in array is empty

oops! Typo... should be for i = 1:length(theta) % ^^ end Two more unrelated tips: Always pre-allocate your lo...

First cell in array is empty

oops! Typo... should be for i = 1:length(theta) % ^^ end Two more unrelated tips: Always pre-allocate your lo...

4 days ago | 1

| accepted

Answered

How to filter a cell array filled with strings?

This will return a logical array the same size as 'A' where TRUE values indicate elements of A that meet the following requireme...

How to filter a cell array filled with strings?

This will return a logical array the same size as 'A' where TRUE values indicate elements of A that meet the following requireme...

4 days ago | 1

| accepted

Answered

How can I use Textbox input from GUI in a separate script?

"I want to use the input of the textbox of my gui which i have created with guide, in a seperate Matlab script" There are sever...

How can I use Textbox input from GUI in a separate script?

"I want to use the input of the textbox of my gui which i have created with guide, in a seperate Matlab script" There are sever...

4 days ago | 0

Answered

Why is format long providing a strange result?

It's because of the way you're combing two variables in the output display. Look at the last iteration of your 2nd for-loop. ...

Why is format long providing a strange result?

It's because of the way you're combing two variables in the output display. Look at the last iteration of your 2nd for-loop. ...

4 days ago | 0

Answered

Swapping entries in column of table

I'm not sure why you're using string characters instead of numbers but I'll assume you have a reason for that. Here's how to ide...

Swapping entries in column of table

I'm not sure why you're using string characters instead of numbers but I'll assume you have a reason for that. Here's how to ide...

4 days ago | 0

| accepted

Answered

What does the 'imfuse' output mean?

Regarding the line of code Fused = imfuse(Image3, Image4, 'falsecolor'); For the falsecolor method, by default, Fused is a com...

What does the 'imfuse' output mean?

Regarding the line of code Fused = imfuse(Image3, Image4, 'falsecolor'); For the falsecolor method, by default, Fused is a com...

4 days ago | 1

Answered

STROOP TEST- COGENT

The handle to the text object and the handle to the "square" (not sure what you mean here, it could be a rectangle object, a pat...

STROOP TEST- COGENT

The handle to the text object and the handle to the "square" (not sure what you mean here, it could be a rectangle object, a pat...

4 days ago | 0

| accepted

Answered

On Startup: function name warning

None of the toolboxes are crashing - those are just warnings that you've got two functions with the same name. Don't delete a...

On Startup: function name warning

None of the toolboxes are crashing - those are just warnings that you've got two functions with the same name. Don't delete a...

4 days ago | 0

Answered

moving scroll index in a ui figure

TL;DR: Don't waste your time, it's not currently possible in AppDesigner (r2019b). Programmatically scrolling to a specific r...

moving scroll index in a ui figure

TL;DR: Don't waste your time, it's not currently possible in AppDesigner (r2019b). Programmatically scrolling to a specific r...

5 days ago | 1

| accepted

Answered

Error using speech2text

Hmmm..... it still looks like you're not using the most recent version. In this section of your error stack Error in speech2...

Error using speech2text

Hmmm..... it still looks like you're not using the most recent version. In this section of your error stack Error in speech2...

5 days ago | 0