Community Profile

# dpb

4,074 total contributions since 2012

View details...

Contributions in
View by

Customizing MATLAB Plots and Subplots
The new(ish) yyaxis function to arbitrarily create two y axes and then switch between left and right axes w/o the need of yyplot...

약 4시간 ago | 0

Select specific data from txt file
Just read the file into memory and do a find() -- since it's an integer that'll be exact. What do you do if there isn't a matc...

약 15시간 ago | 0

for loops not working
"The MATLAB way" is to avoid the loops altogether... N=10; M=1000; [X,Y]=meshgrid([1:N],1:M]); func=(X*pi/Lx).^2 +(Y*pi/Lz).^...

1일 ago | 0

How can I shift the elements in a vector without losing the elements? just shift the order
Sorta' inconsistent definition, but look at >> A=1:10; >> circshift(A(4:end-2),-2) % case 1 ans = 6 7 ...

2일 ago | 0

How to transform an array into a bottom triangle
On the above assumption, if V is the vector, then N=149; % array size parameter R=V(cumsum([N:-1:1])); ...

3일 ago | 0

Finding elements of an arrays having specified index numbers
Given you return the indices in vectors ix and iy, then V=A(sub2ind(size(A),ix,iy)); where A is the other array and V will be ...

3일 ago | 1

Use the index of an element of a subset to find its index in the large set?
tipPt=[2 3 2]; % the two located points smpPt=[2 3 1]; % return their locations in the two arrays, respectively ...

3일 ago | 0

| accepted

vertical error bar in loglog plot
hEB=errorbar(x,A,err); hAx=gca; hAx.XScale='log'; hAx.YScale='log'; You'll have to have defined the error magnitude array, e...

3일 ago | 0

| accepted

Having multiple lines in a character array for column labels in a heatmap
Unless TMW has finally fixed it, the TickLabel interpreter is pretty brain dead...you can do something like ColumnLabels=strrep...

3일 ago | 0

| accepted

Replace categorical value with numeric values
If categorical variable is c, then d=double(c)-1; presuming didn't define them except by default which will be in alphanumeric...

5일 ago | 0

i need to compare a matrix with a static table
> [interp1(Y(:,1),Y(:,2),X(:,1)) interp1(Z(:,1),Z(:,2),X(:,2)) interp1(A(:,1),A(:,2),X(:,3))] ans = 279.6900 255.4500 247....

5일 ago | 0

| accepted

msgbox is not displaying the string entered in body
Should be msgbox('Message','Title')

5일 ago | 0

Generate beta random number without statistics toolbox
Given Ui are uniform random variates Y1=U1/α1 and Y2=U1/β1, such that Y1+Y2<=1, then X=Y1/(Y1+Y2) follows the beta dist...

7일 ago | 0

| accepted

how to fit a a curve using gamma fit
See doc gamfit but all the inflection points in the green curve have no chance to be reflected in a fitted function.

8일 ago | 0

Randomly assign a value to each column of a matrix
Not way subscript expansion works as written...use seqS(sub2ind(size(seqS),[1:mt].',t)) = true; instead

8일 ago | 0

| accepted

Accessing Character Vectors Within Cell Arrays, Output Is Size of Character Vector, not Contents?
While not your specific question, couldn't help but recast your function using standard MATLAB functions for various operations ...

8일 ago | 0

Moving mean in matrix
% Identify the columns that contain at least one 999999 isKey = matriz_media == key; colIdx = find(any(isKey,1)); ...

8일 ago | 0

how do you get the max y value in an fplot?
Look at the documentation and see what else you can do with fplot... fp=fplot(mu,[0 100]); [mxMu,imx]=max(fp.YData); % ...

8일 ago | 0

3D plotting help
Per the documentation for scatter3, scatter3(X,Y,Z,S,C) draws each circle with the color specified by C. If C is a RGB triple...

9일 ago | 0

| accepted

Renaming batch names removing extensions
Job for command. Make a .cmd batch file from the following--name DORENAME.CMD or somesuch... echo off setlocal for %f in (18...

10일 ago | 0

| accepted

Plotting fresh plot for every iteration and change x-direction
Some basic "issues"... Your figure line is figure(6) which always reverts to the same figure you requested so it's not surprisi...

10일 ago | 1

| accepted

How can I modify appearence of multiple plots?
Save the errorbar object returned handles and set properties as desired.

11일 ago | 1

| accepted

Convert 1x2 double to 1x1 string
>> string(sprintf('[%d,%d]',s)) ans = "[3,7]" >> or, with features built into the new string class that mimic VB in ma...

11일 ago | 1

| accepted

How do I change datetime format in stackedplot on X-Axis?
hAx=gca; hAx.TickLabelFormat='hh:mm:ss'; You can set the XTick values as wanted but there will not possibly be room to label m...

11일 ago | 0

How to write Multiple data to Excel
xlswrite is documented to accept one array for output...you've got two disparate pieces of data to place in the spreadsheet--you...

11일 ago | 0

Loop for extracting a matrix
nAvg=10; mnAV=reshape(mean(reshape(av,nAvg,[])),[],2); Same caveat w/ Guillaume; errors if not divisible by nAvg and the final...

11일 ago | 0

Calculate the hourly battery capacity
... B_Energy_t(i)=B_Energy_t(i-1)+delta_B_t(i); if B_Energy_t(i)>(R_B*A_B) B_Capacity_t(i)=R_B*A_B; if B_Energ...

11일 ago | 1

| accepted