Community Profile

photo

dpb


3,372 total contributions since 2012

Contact

dpb's Badges

  • Thankful Level 2
  • 36 Month Streak
  • Ace
  • Revival Level 1
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
using switch, case and comparing strings
function Menu(varargin) switch varargin{1} % you already said first argument is string case 'hot dog' ...

8 hours ago | 0

Answered
How do I crop white space from datetime plots ?
xlim([datetime(yL,mL,dL) datetime(yR,mR,dR)]) where yX,mX,dX are year/month/date for Left/Right axes limits desired. _Pres...

13 hours ago | 0

Answered
how to read data and put them into separate line?
In that case (known record length) >> L=23; % define record length >> fmt=repmat('%c',1,L); % format...

14 hours ago | 0

| accepted

Answered
How to store value in a two dimentinal array in matlab
Every time you execute B = cell(size(e)); you create a new empty cell array of size(e) empty matrices so for every loop...

1 day ago | 0

Answered
How can I get data computed inside of a function to my work space to use?
Anything you want to can be returned as one or more output arguments either as individual variables or arrays or any other highe...

1 day ago | 0

| accepted

Answered
Matlab text file opts varying for similar files
The difference is that the second file has the UND indicator in the first data line whereas the first file has a completed recor...

3 days ago | 1

| accepted

Answered
Import data based on markers in Excel.
Read the text data from the spreadsheet in column A and locate the two fields, then reread with the specified range thus compute...

4 days ago | 0

Answered
Reading a generic text file with string and number
line1 = textscan(fid, '%s%s%s%f%f%f%f%f%f%s%f%s\r\n','HeaderLines',41); >> fmt='%s%s%s%f%f%f%f%f%f%s%f%s' fmt = '...

4 days ago | 0

| accepted

Answered
Plotting equation with specific input range
fnF=@(x) min(1,2*x./(x+5)); x=1:10; plot(x,fnF(x))

4 days ago | 0

| accepted

Answered
How can I create a vector of markers for a scatter plot
... c=[102, 215, 209;253,174,97;215,25,28]/255; m=['o','d','s']; figure, hold on for i=1:size(x,2) scatter (x...

4 days ago | 0

| accepted

Answered
Hi - Please why I don't get the excat amplitude in the spectrum of two added sine waves xt= 0.7*sin(2*pi*50*t)+sin(2*pi*120*t) , I mean i don't get excatly 0.7 for 50 Hz - nor excatly 1 for 120 Hz
To amplify on Ameer's answer... >> [p, fr]=findpeaks(a,f,'minpeakheight',0.25) p = 0.6097 0.9503 fr = 49.8047...

6 days ago | 4

Answered
Using errorbar for multi-column datasets without loop
I get the same error if I try to use a single error value for all _y_ regardless of number of columns; I thought previous versio...

7 days ago | 0

Answered
Plotting a fit with excluded data results in error "Subscript indices must either be real positive integers or logicals."
I can reproduce symptoms here with R2017b; appears to be a bug. I thought perhaps using the named parameter form handle = ...

8 days ago | 1

| accepted

Answered
How to speed up my code
Not surprising replacing with |max| increased run time...see if the following produces same result/makes any significant timing ...

8 days ago | 0

| accepted

Answered
Cannot get textscan() while loop to work
Format string is in error; the last numeric value on each record is floating point. fmt=['%s%s' repmat('%f',1,3)]; % text...

9 days ago | 0

Answered
Finding the First Dates of each Month
If the sample dates are what your data file has for the first data in the respective month and year, it appears the data are inc...

9 days ago | 0

Answered
Opening files with for loop, switches to parent directory
I'm thinking the code shown doesn't have such a symptom; the content of the variable |file| will be that of |files| as there is ...

9 days ago | 0

| accepted

Answered
Optimizing indirect mapping: From matrix elements to vector values
OK, with the additional information, remove the 2D nature and use |interp1| function density = get_density(x, Density, Grid...

9 days ago | 0

| accepted

Answered
How to plot temporal changes in batches of data?
t=readtable('crowe.csv'); t.SSID=categorical(t.SSID); t.Time=datetime(t.Time); figure,hold on [g,ids]=findgroups(t...

9 days ago | 1

| accepted

Answered
bar graph command for range values
if numtests > 1 figure1 = figure('Color',[1 1 1]); subplot(141); bar(ampsCAP(1,:)); title([int2str(Cs(1,1)) ' Hz']);...

9 days ago | 0

| accepted

Answered
How can I shade an area of my graph between two vertical lines?
iz=linspace(20,24,40); yz=pdf(pd,iz); area(iz,yz) <</matlabcentral/answers/uploaded_files/121187/untitled.jpg>>

10 days ago | 1

| accepted

Answered
Subscript indices must either be real positive integers or logicals.
... normalize8=uint8(normalize); X1=normalize8(X)+0.01; %for the log operation ... You defined |normalize| as a fl...

12 days ago | 0

| accepted

Answered
Adding duration in second as x axis
Don't alias the builtin |duration|; that _will_ create problems working with time objects. You don't really want a duration, ...

12 days ago | 0

| accepted

Answered
how to create multiple axis at x axis on same time window? i have attached one image of that kind. Please help.
Start with |subplot| and mung on it a little... hSp(1)=subplot(3,1,1); % two subplots in space for th...

12 days ago | 0

Answered
Adding more than one greater/less than condition to an 'if statement'
|inpolygon| can do it but you've then got to return both output variables and do the set difference between _in_ and _on_ to get...

13 days ago | 0

| accepted

Answered
How to continue running a script using a saved workspace
You'll have to fix your script such that you don't reallocate data arrays when restarting with a changed lower index of the |for...

13 days ago | 0

Answered
Bug on polyfit output?
"Feature" or "Quality of Implementation" depending on your viewpoint... help polyfit ... [p,S,mu] = polyfit(x,y,n...

13 days ago | 2

| accepted

Load more