Community Profile

photo

dpb


4,197 total contributions since 2012

Contact

dpb's Badges

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

View details...

Contributions in
View by

Answered
Loop for mutliple (but variable) number of plots on multiple pages
Figure out how many figures you need a priori... nplots = 13; pperfigure=12; nfigures=ceil(nplots/pperfigure); nUp=pperfigur...

1 day ago | 0

Answered
Finding the sum of every nth row ( n is not fixed)
You'll have to introduce a day variable...by locating the positions where the hour returns to 0 if is always a 0-hour reading o...

1 day ago | 0

| accepted

Answered
I have multiple equations that depend on a specific value and would like matlab to ask the user which equation to use and what the specific value is and then print that value but it's giving me trouble.
Do something more like: materials={'BK7','Fused Silica','Soda Lime','Borofloat','Air','NOA61'}; [material,ok] = listdlg('Promp...

1 day ago | 0

Answered
How to neatly alternate between two different statements at different intervals
counter=0; Limit=10; for i=1:100 counter=counter+1; if counter<=Limit disp('A') else disp('B') counter...

3 days ago | 0

| accepted

Answered
Help parsing predictably messy data
function getdata=a1(fname) % read file sections, return as cell array of sections for subsequent use fid=fopen(fname,'r'); ...

3 days ago | 0

| accepted

Answered
Sorting Table Data by Groups of Rows
If the number of missing values is always 9, then extract the time column to a vector and t=datatable(:,1); % retrieve th...

3 days ago | 0

Answered
Finding first rightmost non-zero column of a matrix?
Same solution as the other except search from the other end... find(any(A),1,'last') I think Azzi's solution there doesn't fin...

3 days ago | 0

| accepted

Answered
Extract columns from multiple csv files
targetColumn=3; % don't bury magic numbers, use input() to set, maybe... rootdir = 'C:\Work\TESTIN...

3 days ago | 0

Answered
To generate alternate 0's and 1's
One brute force way-- B=[]; for i=1:numel(A) B=[B (1-mod(i,2))*ones(1,A(i))]; end

3 days ago | 1

Answered
How to solve "Matrix dimensions must agree" getting from Matlab.
OK...still a little unclear but I think I've got enough of a picture to at least lay out the general idea. It'd be a lot easier...

4 days ago | 0

Answered
Data Linking And value reassignment for variables
I presume the "~-0" clause is to not eliminate i==j? Or can there be actual identical matches elsewhere? Either way the first...

4 days ago | 0

| accepted

Answered
Troubleshooting Import big excel file
>> t=readtable('export.csv'); >> whos t Name Size Bytes Class Attributes t 45x255 ...

4 days ago | 1

| accepted

Answered
How to solve "Matrix dimensions must agree" getting from Matlab.
if ('difficult = 0-back') & ('sleepstate = SD') is bad syntax on many fronts. First you've built a quoted string by usin...

4 days ago | 0

Answered
Help concatenating a table row to a specific excel spreadsheet?
outputTable=table(VarNameStr,Screen_Grasp_Average,Grasp_Release_Average,difference); writetable(outputTable,D:\LocationName\Dat...

5 days ago | 0

| accepted

Answered
FFT - How is the signal distributed between different frequency bins?
The frequency bins are fixed by the sampling rate; the magnitude of each bin is determined by the computation of the fourier coe...

5 days ago | 1

| accepted

Answered
Plot function into subplots
for i=1:3 hAx(i)=subplot(3,1,i); plot(x(:,i),y(:,i)); end presuming all x,y are same length. If they're not, then savin...

5 days ago | 0

| accepted

Answered
Colormap utility - two axes in colorbar
Yeah, it's doable...refinements needed, but general idea works. Z = peaks(20); [~,hCF]=contourf(Z,10); hAx=gca; ...

6 days ago | 1

| accepted

Answered
Set Properties.VariableContinuity to a single column in a timetable?
Per the documentation, ". This property can be an empty array, which is the default. If the array is not empty, then the number ...

6 days ago | 0

| accepted

Answered
download excel from web, webread doesn't work
Ah! That's actually a link to an Excel spreadsheet file, not web service data. Use websave('UMichSurvey.xls',url) ...

6 days ago | 0

| accepted

Answered
functions suddenly connected after restart
Apparently focus was in the editor and some of your keystrokes CTRL^C got interpreted to paste and some extra end statements wer...

6 days ago | 0

Answered
How to set mmmm dd, yyyy as per our choice in the datestr command?
datestr(datetime(2017,9,2,2,0,0))

7 days ago | 0

Answered
Avoiding automatic sorting of eigenvalues
EIG() does NOT return sorted values; it returns them to the user in the order in which the underlying LAPACK routine calculates ...

7 days ago | 1

Answered
How to display a vector in edit text in MATLAB?
By default it appears the Edit control converts an array to a column array of values and you can't display that in one row...if ...

7 days ago | 0

Answered
remove first element in cell and do not change index of other element
You're overthinking the problem...the first index is always 1... >> cellfun(@(a) 2:numel(a),A,'uni',0) ans = 1×3 cell array...

8 days ago | 0

| accepted

Answered
a big cell array
Follow the documentation--for xlswrite, every cell element has to be a single value. So, if your array has cells (or any single...

8 days ago | 0

Answered
How can I include Tukey (HSD) result in my boxlpot as "a" and/or "b" indicating whether there is a significant difference or not between the groups?
Kinda' a fun one... :) First, make sure your boxplot is gca, then the following seems to be pretty robust...the one probably un...

8 days ago | 1

| accepted

Answered
List combinations and count how many it appears
y=Y(W~=0,:); z=unique(sort(cell2mat(arrayfun(@(i) nchoosek(y(i,y(i,:)~=0),2),1:size(y,1),'uni',0).'),2),'rows'); nZ=arrayfun(@...

8 days ago | 1

Answered
How to replace all 1x1 cells containing 'NAN' with 'NaN'?
opt=detectImportOptions('Equinor.txt'); t=readtable('Equinor.txt',opt); >> t.TIMESTAMP=datetime(t.TIMESTAMP,'InputFormat','uuu...

9 days ago | 0

| accepted

Answered
How to obtain the unique combinations of two columns in a table
year = [1994, 1994, 1994, 1995, 1995, 1995, 1996, 1996, 1996].'; type = {'AA', 'BB', 'CC', 'BB', 'BB', 'BB', 'AA', 'CC', 'CC'}....

9 days ago | 0

| accepted

Answered
Relative frequency y-axis using the histfit function
IIUC, N1=sum(h1(1).YData); N2=sum(h2(1).YData); h1(1).YData=h1(1).YData/N1; h1(2).YData=h1(2).YData/N1; h2(1).YData=h2(1).Y...

10 days ago | 0

| accepted

Load more