# Dave B

### MathWorks

I am a software engineer at MathWorks. My work focuses on graphics and charting.

**Statistics**

RANK**136**

of 243.834

REPUTATION**694**

CONTRIBUTIONS

**0** Questions

**217** Answers

ANSWER ACCEPTANCE **
0.00%
**

VOTES RECEIVED**61**

RANK**13.781** of 17.054

REPUTATION**9**

AVERAGE RATING**5.00**

CONTRIBUTIONS**2** Files

DOWNLOADS **16**

ALL TIME DOWNLOADS**53**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Convert Python time to Matlab datum

Python has several ways it represents time. A common one is so called unix timestamps, which are the number of seconds since 197...

2 días ago | 1

| accepted

error when using datetime()

Does it work if you add str2double? like this: S.date = datetime(S.Year, S.Month, str2double(S.Day), 0, 0, 0, 'Format', 'uuuuMM...

2 días ago | 0

| accepted

How can I build a matrix with an increasing number of terms in each row?

You can't have a matrix with a different number of elements on each row, but if you wanted the sums 1, 1+2, 1+2+3,... (as you de...

3 días ago | 0

| accepted

Call fields from a struct

I'm a little confused, but I'll venture some guesses.... Do you have a struct init in your workspace (where you're calling th...

3 días ago | 0

surf command doesn't plot the value next to NaNs values

If you think of surf as defining a bunch of little rectangles, when one vertex is missing you can't draw the rectangle. Your d...

3 días ago | 1

| accepted

Printing cell array with skipping a value

If you want to get rid of just the one value, how about setting it to empty inside of matComp. Note that you'll end up with one ...

3 días ago | 0

| accepted

tiledlayout not forming figures as intended

Just pasting my comment in the answer in case it may help someone else, it struck me as strange that there was a hold on before ...

3 días ago | 0

Specifying a sample of data from a table

This sounds like a pretty broad topic, how to index things in MATLAB. You might be interested in this documentation page abou...

4 días ago | 0

How to save a figure of a specific size with exportgraphics

you created a tiledlayout in one figure, set some of its characteristics but didn't add anything to it. Then you created a new f...

4 días ago | 0

| accepted

Saving a functiong graph inside a matrix

You can use im2gray to convert an RGB matrix to grayscale: x = linspace(-5,5,100); y = x.^2; plot(x,y) fr=getframe(gca); gr...

4 días ago | 1

add arrowtext outside the figure

annotations are defined with respect to the figure, in the units of the figure. plot(rand(1,10)) pos=get(gca,'Position') o...

4 días ago | 0

what does thegrid{1}.points=(1:n); mean?

Cell arrays are containers for heterogenous data, each cell can hold arbitrary types/sizes/shapes. Cells are addressed with { } ...

4 días ago | 1

How to make a plot in function of timetables expressed in UTC ?

It's probably easier if you use readtable instead of load, which will pull in the times automatically: t=readtable('Dates.txt')...

4 días ago | 1

| accepted

Google sheets to table in matlab

You might try this file exchange submission: https://www.mathworks.com/matlabcentral/fileexchange/39915-getgooglespreadsheet An...

4 días ago | 0

Why is my plot not working in my for loop?

this isn't running a loop because you're iterating from 1 to length(theta2) and length(theta2) is 0 theta2=linspace(0,2*pi,2*pi...

4 días ago | 0

Polymarker geographic contour plot

Yes this is possible. I wouldn't call this a contour plot, it's really more like a bubble plot. You can't make triangles with...

4 días ago | 0

| accepted

if or for loop

You can find the index of the first and last instance of power greater than 0 using the find function, then put those indices ri...

4 días ago | 0

| accepted

A function that counts the number of zeros in a vector

you were pretty close, you just didn't need the find, or the /11 D = [ 1 0 1 0 1 0 1 0 1 ...

5 días ago | 1

How to call one of two conditions in matlab function?

When you call a function with one output MATLAB will return the first output, the names specified for outputs when calling it ar...

5 días ago | 0

| accepted

gunzip subfolders at once

You can pass wildcards to gunzip (note that the first example does exactly this): fp = 'C:\Main\Data\subf1\subf2\subf3\subf4\su...

5 días ago | 0

| accepted

How do I fix axis labels and numbers?

I think you want your y-axis (which, because of your use of camroll is the horizontal axis) at the bottom. Because MATLAB still ...

5 días ago | 0

Number of elements mismatch.

This seems like you maybe over complicated it? Is it as simple as... x=[1;3;5] fcn(x) function pdot = fcn(pd) pdot=[pd;0...

5 días ago | 1

| accepted

Running several regressions and storing all the data with regress

You're getting this error because you're trying to store the result of bint (which is a 2 x 2 matrix) in a scalar location (tSta...

5 días ago | 1

| accepted

How to remove all zeros in a matrix to use for calculations?

I think your strategy looks good (although you're missing a ( in your example code) Could it be that the values are not exact...

6 días ago | 0

Why do I get "Array indices must be positive integers or logical values"?

You're getting this message because of the line: vt=vf(1-exp(-t/tao)); vf is the number 18, or, more precisely it's a matrix o...

6 días ago | 0

Why do I get "Array indices must be positive integers or logical values"?

You're getting this message because of the line: vt=vf(1-exp(-t/tao)); vf is the number 18, or, more precisely it's a matrix o...

6 días ago | 0

How to save multiple 3x1 matrixes in one big matrix?

How about: f = 100:500; X = nan(length(f),3); A = [2/7, -1.5/6.5, -1/3; 3/7, 2/6.5, -2/3; -6/7, -6/6.5, -2/3]; for i = 1:l...

6 días ago | 1

| accepted

How to plot x and y

There are a couple of options for how you think about this problem. I might do it like this: t = 0:100; % you could just do [0 ...

7 días ago | 0

Can anyone help me with the a tentative guide on how to average across the two dimensions of a 3d array, and loop it across 86 timesteps?

Let's do this with a smaller array, as the specific numbers don't seem particularly important. I'll do 5x4x3 so we can see the v...

7 días ago | 1

Taking input from large excel data stored in multiple sheets based on different variables.

If you look at the documentation for readtable you'll see that you can read a sepcific sheet name from an excel spreadsheet. T...

7 días ago | 0