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

Random display of 'even' or 'odd'

Here are the 5 steps you need to take. Since this is your assignment, this answer isn't complete. Each step shows what you nee...

Random display of 'even' or 'odd'

Here are the 5 steps you need to take. Since this is your assignment, this answer isn't complete. Each step shows what you nee...

30 minutes ago | 0

Answered

Link axes with different Y-Scales

Currently (r2019b) the UI stack cannot be controlled with yyaxis axes which always results in right-axis objects at the top of t...

Link axes with different Y-Scales

Currently (r2019b) the UI stack cannot be controlled with yyaxis axes which always results in right-axis objects at the top of t...

3 hours ago | 0

| accepted

Answered

how do bins in histograms work?

What you're describing sounds like a bar chart rather than a histogram. 1000 bars is quite a lot of bars. data = logical(randi...

how do bins in histograms work?

What you're describing sounds like a bar chart rather than a histogram. 1000 bars is quite a lot of bars. data = logical(randi...

15 hours ago | 0

Answered

List of built-in data sets, please

I started a list of built-in mat files and a brief description of their variables. Since numeric variables are fairly easy to c...

List of built-in data sets, please

I started a list of built-in mat files and a brief description of their variables. Since numeric variables are fairly easy to c...

16 hours ago | 1

Answered

Merging table rows, keep all columns

% Read in the data files = {'RESULTS_SAMP1.CSV', 'RESULTS_SAMP2.CSV'}; %Full paths are always better T1 = readtable(files{1},...

Merging table rows, keep all columns

% Read in the data files = {'RESULTS_SAMP1.CSV', 'RESULTS_SAMP2.CSV'}; %Full paths are always better T1 = readtable(files{1},...

19 hours ago | 0

| accepted

Answered

How i can change the x-axis labels and ticks like that

If you're using Matlab r2019b or later, you can use tiledlayout() to create your subplots (see examples in that link). For earl...

How i can change the x-axis labels and ticks like that

If you're using Matlab r2019b or later, you can use tiledlayout() to create your subplots (see examples in that link). For earl...

21 hours ago | 0

Question

List of built-in data sets, please

It would be great if Matlab documentation included a list of built-in data sets. This question has been asked before (2012, 201...

22 hours ago | 2 answers | 2

Answered

How to calculate mean of values based on bins created from a corresponding vales?

Generally the edges should cover the span of your data, no more and no less with the exception that the final edge should be sli...

How to calculate mean of values based on bins created from a corresponding vales?

Generally the edges should cover the span of your data, no more and no less with the exception that the final edge should be sli...

23 hours ago | 1

| accepted

Answered

How to represent each grid numerically?

% Inputs xrng = [0,9]; % [left, right] bound of x axis yrng = [0,8]; % [lower, upper] bound of y axis gridInt = ...

How to represent each grid numerically?

% Inputs xrng = [0,9]; % [left, right] bound of x axis yrng = [0,8]; % [lower, upper] bound of y axis gridInt = ...

1 day ago | 0

Answered

Sort matrix based on values in the first row from small to large

newM = sortrows(m.').'; That's pretty straightforward ;)

Sort matrix based on values in the first row from small to large

newM = sortrows(m.').'; That's pretty straightforward ;)

1 day ago | 0

Answered

Regular expression for 1*1 cell array

c = {'<string_attribute name="country"><s>CHINA5</s></string_attribute>'}; out = regexp(c, '(?<=name="country"><s>)(.*)(?=</s>...

Regular expression for 1*1 cell array

c = {'<string_attribute name="country"><s>CHINA5</s></string_attribute>'}; out = regexp(c, '(?<=name="country"><s>)(.*)(?=</s>...

2 days ago | 1

| accepted

Answered

My Matlab opens several files on startup R2018

My bet is that you have a startup.m file which is run upon matlab startup. Within that file are commands to do some stuff that ...

My Matlab opens several files on startup R2018

My bet is that you have a startup.m file which is run upon matlab startup. Within that file are commands to do some stuff that ...

2 days ago | 0

| accepted

Answered

Pad a table without variable names

Create a table with just 0s and with VariableNames that match your original table. The number or rows in your zeros-table shoul...

Pad a table without variable names

Create a table with just 0s and with VariableNames that match your original table. The number or rows in your zeros-table shoul...

2 days ago | 0

| accepted

Answered

reduce density of a time series

" I imagined a code which compares two values (e.g. a_i - a_i+1) and if the result is below a certain threshold the second valu...

reduce density of a time series

" I imagined a code which compares two values (e.g. a_i - a_i+1) and if the result is below a certain threshold the second valu...

2 days ago | 1

Answered

Grouping Data: How do I group all the rows with the same number on the second column together?

For a single group's mean mu = mean(m(m(:,2)==1,3)); % 1 2 3 4 % 1: the variable name of your matix % 2: colum...

Grouping Data: How do I group all the rows with the same number on the second column together?

For a single group's mean mu = mean(m(m(:,2)==1,3)); % 1 2 3 4 % 1: the variable name of your matix % 2: colum...

2 days ago | 0

Answered

A data processing problem

% Determine where BSid values change deltaBSid = diff(I.BSid)~=0; % Create a logical vector identifying the first and last r...

A data processing problem

% Determine where BSid values change deltaBSid = diff(I.BSid)~=0; % Create a logical vector identifying the first and last r...

2 days ago | 0

| accepted

Answered

Sorting a data set to report failing values in pairs instead of individually

I think you're looking for.... % Coordinates you're keeping keepCoordinates = A(i2keepHS_HS2, :); % Coordinates you're no...

Sorting a data set to report failing values in pairs instead of individually

I think you're looking for.... % Coordinates you're keeping keepCoordinates = A(i2keepHS_HS2, :); % Coordinates you're no...

2 days ago | 0

| accepted

Answered

contextmenu in axes in GUI

Follow the example described in the documentation (link below). This code will go in your OpeningFcn function. https://www.m...

contextmenu in axes in GUI

Follow the example described in the documentation (link below). This code will go in your OpeningFcn function. https://www.m...

2 days ago | 0

Answered

Assigning row to array using cellfun

Here's your loop, within cellfun(). A = cellfun(@(x)[x(1:counter-1,:);B;x(counter+1:end,:)], A, 'UniformOutput', false);

Assigning row to array using cellfun

Here's your loop, within cellfun(). A = cellfun(@(x)[x(1:counter-1,:);B;x(counter+1:end,:)], A, 'UniformOutput', false);

3 days ago | 0

| accepted

Answered

Taking 1d cuts of data along polar contours

Your data are quite coarse. You can see the unit squares that make up each coordinate. So, you won't be able to create a perfe...

Taking 1d cuts of data along polar contours

Your data are quite coarse. You can see the unit squares that make up each coordinate. So, you won't be able to create a perfe...

3 days ago | 0

| accepted

Answered

Read .txt and Write in matab

Read in the whole file at once. In this example I'm using fileread() because I'm unfamiliar with the FEX submission readfile() ...

Read .txt and Write in matab

Read in the whole file at once. In this example I'm using fileread() because I'm unfamiliar with the FEX submission readfile() ...

3 days ago | 0

Answered

about function rats and how to output to .txt

a1 = strtrim(rats(a/pi)); Use strtrim() to remove leading and trailing white space.

about function rats and how to output to .txt

a1 = strtrim(rats(a/pi)); Use strtrim() to remove leading and trailing white space.

3 days ago | 1

| accepted

Answered

Finding change point of an array values

There are probably some smart algorithms that will be helpful (Image Analyst mentioned some hints). But here's a lower-level s...

Finding change point of an array values

There are probably some smart algorithms that will be helpful (Image Analyst mentioned some hints). But here's a lower-level s...

4 days ago | 0

| accepted

Answered

How to find values greater than a number in a cell of empty cells?

D = {[],[],3,[], -2, 0, [], 1, 6, []}; idx = cellfun(@(x)~isempty(x) && x >= 0, D); % logical index If you need the subscript...

How to find values greater than a number in a cell of empty cells?

D = {[],[],3,[], -2, 0, [], 1, 6, []}; idx = cellfun(@(x)~isempty(x) && x >= 0, D); % logical index If you need the subscript...

5 days ago | 0

| accepted

Answered

Invalid data type. First argument must be numeric or logical.

My guess is that.... [RT_CD_row,RT_CD_col]=size(RT_CD_Data); for C=1:1:RT_CD_row RT=(RT_CD_Data{C,1}); % ...

Invalid data type. First argument must be numeric or logical.

My guess is that.... [RT_CD_row,RT_CD_col]=size(RT_CD_Data); for C=1:1:RT_CD_row RT=(RT_CD_Data{C,1}); % ...

6 days ago | 0

Answered

Find the perfect overlay of 2 maps of points

You can compute the difference between the x values from each set and the y values from each set which will create a matrix of o...

Find the perfect overlay of 2 maps of points

You can compute the difference between the x values from each set and the y values from each set which will create a matrix of o...

6 days ago | 0

Answered

How do i change my script to print out the second word of each even line?

Instead of reading the file line by line you could read in the entire text file and then extract the 2nd word from even numbered...

How do i change my script to print out the second word of each even line?

Instead of reading the file line by line you could read in the entire text file and then extract the 2nd word from even numbered...

7 days ago | 0

| accepted

Answered

reshaping error after clustering pixels > 0 in image

I understand the problem but I don't have an entirely clear picture of what the imIDX variables should be. I think all you ne...

reshaping error after clustering pixels > 0 in image

I understand the problem but I don't have an entirely clear picture of what the imIDX variables should be. I think all you ne...

8 days ago | 0

| accepted

Answered

how to plot a cute sphere

If you don't have access to the cuteSphere toolbox, you can just use this line of code below to make the sphere appear as a sphe...

how to plot a cute sphere

If you don't have access to the cuteSphere toolbox, you can just use this line of code below to make the sphere appear as a sphe...

8 days ago | 1

Answered

Changing the transparency of a plot line, saved in a fig file

Manually edit each line object The easiest method would be to open the fig file, use the pointer to select the line you'd like ...

Changing the transparency of a plot line, saved in a fig file

Manually edit each line object The easiest method would be to open the fig file, use the pointer to select the line you'd like ...

9 days ago | 1

| accepted