Community Profile

photo

dpb


Last seen: Today Active since 2012

Statistics

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

View badges

Content Feed

View by

Answered
I have a function (ex. adaptive) in a for loop which has two arrays as output. I want to save all the outputs in a single matrix. it can just save the last vector
You have to index the out arrays on the LHS of the assignment or MATLAB will, as you've observed, overwrite the whole variable o...

1 dag ago | 0

| accepted

Answered
How can I index a duration variable
Always much easier if you attach the actual code you've used to get to this point and a little bit, at least of the data array. ...

1 dag ago | 0

| accepted

Answered
How do I pull out from a table, the total mean of one item based on a particular condition (for several subjects), and then compute the difference in mean values?
tMEANS=rowfun(@mean,tData,'GroupingVariables'{'ConditionZ'},'InputVariables','ItemA','OutputVariableNames','GroupedMeans'); See...

2 dagen ago | 0

Answered
Help creating loop that converts text to numbers
>> A='Now is the time...'; >> format short >> disp(double(A)) 78 111 119 32 105 115 32 116 104 101 ...

2 dagen ago | 0

Answered
Removing quotations from table display
It's more a sanity check for the user to make sure their values are correct for what they expect. And there's where the purpose...

3 dagen ago | 0

Answered
fwrite ascii output error
I see no such thing... >> fid=fopen('test2.dat'); fread(fid,'*int16') fid=fclose(fid); ans = 2×1 int16 column vector ...

3 dagen ago | 0

Answered
How to reform cell into a vector of strings and text
Two of many ways to deal with the cellstr -- As string array >> S=string(split(C,',')); S=S(S~="") S = 6×1 string array ...

3 dagen ago | 0

Answered
How do I swap 2 rows of a cell array?
One way... >> C=num2cell(randi(10,3,2)) C = 3×2 cell array {[5]} {[1]} {[9]} {[5]} {[6]} {[5]} >> ...

3 dagen ago | 0

| accepted

Answered
how to find the nearest value?
The builtin way in MATLAB is interp1 >> A=[1:6]; >> B=flip(A)+0.1; >> posn=[10:10:60]; >> C=posn(interp1(B,A,A,'nearest','ex...

3 dagen ago | 0

Answered
Problems with function num2str
Well, having a file helps (as always)... >> DatosInfo=ncinfo('..\Answers\DatosMarzoD1.nc') % see what's in the file... DatosIn...

4 dagen ago | 1

| accepted

Answered
How to put endpoint on Bar graph
Like maybe? There's a klunky example at the doc for bar, but it is far simpler than the multi-step illustration to write it ...

4 dagen ago | 0

Answered
How to calculate standar deviation and trend in each row of data
The input arguments for std include a flag for the weighting for the divisor and/or the option to compute a weighted standard de...

4 dagen ago | 0

Answered
Multiple axes in a subplot
It's a pain -- MathWorks doesn't think you're supposed to ever want to do that; there are no builtin tools to do it. There may ...

6 dagen ago | 0

Answered
how to plot each bin of data individually?
OK, here's another example; I'll add it as its own Answer -- carrying on from the above uBin=unique(tD.Bin); for i=uBin(:).' ...

6 dagen ago | 1

Answered
Reshaping array with specific order
Can't be done with only reshape. You have only 10 elements in A and the requested output array requires 20. OTOH, it's easy en...

6 dagen ago | 0

Answered
Convert cell array to excel - problem with nested cells
Try something like l=0; for i=1:size(M2,1) for j=1:size(M2,2) l=l+1; writecell(M2(j,i),'M2.xls','Range',"A"+...

7 dagen ago | 0

| accepted

Answered
Removing automatic variable names in array2table or writetable and adding some text to the header of output file
As @Ive J points out, define variable names as desired. NB there's no need for intermediate variables here, either--if you alre...

7 dagen ago | 0

Answered
how to plot each bin of data individually?
As per usual, would be easier to demonstrate with some real data to work with...but tD=table(repmat([0:23].',4,1),randi([150 20...

7 dagen ago | 0

| accepted

Answered
Why does the unique() function give an unexpected extra output here?
>> load ..\Answers\datestrings_of_problem_times.mat >> whos d* Name Size Byte...

7 dagen ago | 1

| accepted

Answered
Excel MMULT on MATLAB for different matrix dimensions.
MATLAB being defined as the MATrix LABoratory follows conventional matrix algebra rules -- >> A=[0.29;-1.55;2.09;0.782]; >> R=...

8 dagen ago | 1

| accepted

Answered
Array indices must be positive integers or logical values.
In ... i=0; while dt<ts; d1=g-0.5.*rho.*V0.^2*(s/m).*Cd; phiAvg=d1; V(i)=V0+dt.*phiAvg; V0=V; t(i)=t...

8 dagen ago | 1

Answered
How to fix: Index Exceeds Matrix Dimensions.
>> w1{1}=fix(randi([-10000,10000],3,1)); >> whos w1 Name Size Bytes Class Attributes w1 1x1 ...

8 dagen ago | 0

Answered
Replace text in a struct with new values
The problem is the string you're building for the substitution doesn't match the actual string in the struct substring owing to ...

8 dagen ago | 0

Answered
different number of delimiters error using readtable function
Use import options object -- although to write a fully generic import code you'll have to scan the file to find the number of he...

9 dagen ago | 1

| accepted

Answered
How can I include absent group names in table grouping results?
Well, unless the data are in the table, there's not going to be anything for groupsummary to operate over to tell it those other...

9 dagen ago | 0

Answered
I can't understand the following MATLAB code documentation
This isn't documentation, this is actual MATLAB code. The first section is a script; the second is a function which is called b...

9 dagen ago | 1

Answered
How to show that calculation is going in MATLAB App
An outline of the progress dialog implementation I used for one app... % Button pushed function: UpdateButton function ...

12 dagen ago | 0

Answered
How to make an if-statement that finds whether a 1x5 column has 4 of the rows the value 0?
Just a somewhat pedantic comment on details of notation first -- If the matrix is 1x5, it would be matrix = [0 0 0 241 0] inst...

12 dagen ago | 0

Answered
How to extract data stored in a matrix and in a specific range of columns whose number is stored in another matrix?
It would be much simpler if you would use a table for each variable and include the ParticipantID as a variable instead. Howeve...

18 dagen ago | 0

Answered
Matlab default font monospace is not a wise choice
Can't say as it's been a problem for me, no... But, you can change it to anything installed on your system -- go to Preferenc...

18 dagen ago | 0

Load more