Answered
Counts the number of times the signal crosses zero
Use zcd = dsp.ZeroCrossingDetector; to create the object per the documentation. Then you pass that object the data... numZero...

6 years ago | 0

Answered
Looping through different sheets/sheet names in each loop to access data
You've embedded the text string '({SheetNames}.(iSheetData}' in the readtable call instead of using the variable Sheetnames. Ju...

6 years ago | 0

| accepted

Answered
Deleting Characters from String and Repeating
Well, I don't know how you get L=96 from 50 bytes and I don't think it's likely what you're really going to need, but.. Given t...

6 years ago | 0

| accepted

Answered
plot 3D minimum value of a function
Don't think it could be any easier...look at the following from one of the surf examples: [X,Y,Z] = peaks(25); CO(:,:,1) = zer...

6 years ago | 1

Answered
Plot graph with different markers
See <Marker in Graphplot properties>. Pass an index array to the position of the desired marker type as the 'Marker' property. ...

6 years ago | 1

| accepted

Answered
Concatenating strings w/ character with while loops
>> myname = 'Nate Johnson'; >> split(myname) ans = 2×1 cell array {'Nate' } {'Johnson'} >> presuming the nex...

6 years ago | 0

| accepted

Answered
How to find the name of the first filed of a struct?
If the struct variable is s, then name=fieldnames(s); name=name(1); No way to write the second-level addressing w/o the inter...

6 years ago | 1

| accepted

Answered
Replace NaN with Blanks
Can't be done--a double array has to be regular in both dimension; can't have holes. Only possibility is to convert to a cell a...

7 years ago | 0

Answered
fprintf and fscanf same format fail to read file. appreciate help
MATLAB is NOT Fortran. As Stephen notes above and is documented, fscanf returns a single array of a given class; if there are a...

7 years ago | 1

| accepted

Answered
fprintf and fscanf same format fail to read file. appreciate help
fprintf(fid,'%5i%5i %17.4E%17.4E\r\n', A); will write A in column-major order, not row-major as you're trying to read it in l...

7 years ago | 0

Answered
How to combine datetime and duration columns to form 1 new datetime column in table
Add the duration to the date... Starting with: t = 3×3 table Date Time Data ___________ ____...

7 years ago | 5

Answered
How to Delete certain rows in a Matrix
Use indexing expressions... N1=15; % number to save N2=90; ...

7 years ago | 1

| accepted

Answered
How to customize the subplots?
Just make the additional adjustments to axes/line properties in each subplot as you create it. As you've written it, that means...

7 years ago | 1

| accepted

Answered
Updating a matrix through a loop
>> nR=sum(m~=0,2); % the number by row nonzero entries >> m(:,any(m(nR==max(nR),:),1))=[] % remove colu...

7 years ago | 0

Answered
How do I make text color black when using the function insertText
Read the rest of the documentation... 'BoxColor' — Text box color 'yellow' (default) | character vector | cell array of chara...

7 years ago | 1

| accepted

Answered
MATLAB showing two equal numbers as not equal to each other
Not remembering floating point rounding. Try principal_stress(1,1) - principal_stress(2,1) and see what the result is. You'l...

7 years ago | 0

Answered
converts a point in cartesian to cylindrical and spherical cooridantes(error:getting same answer in cylindrical & spherical coordinates)
if x,y > 0 phi = atan(y/x); elseif x,y < 0 phi = atan(y/x)+pi; elseif x>0 && y<0 The if statements are bad syntax ...

7 years ago | 0

| accepted

Answered
Indexing dates yearly and quarterly.
Use a timetable and retime with a custom method function.

7 years ago | 1

Answered
How to plot a histogram along a curve
Well, your data is rather unique (so to speak :) ): I was trying to figure out how you did the opacity thing in knowing the rel...

7 years ago | 0

Answered
SOLVED: Summing values together until certain value is reached - then repeat - and plot
OK, a working script...I set the setpoint to 250 so would have more than one condition satisfied for testing... tt.Level=zeros(...

7 years ago | 1

| accepted

Answered
How to plot a histogram along a curve
Oh. That's much more understandable, thanks. Something like histogram2(x.',y.','Normalization','pdf','FaceColor','flat') col...

7 years ago | 1

Answered
Insert value for the last day of the year
May be a neat way with the builtin datetime lookup functions, but first thing that comes to mind is isyrlast=false(size(dates))...

7 years ago | 1

| accepted

Answered
SOLVED: Summing values together until certain value is reached - then repeat - and plot
Not fully coded, but the idea should work to build loop... t=readtable('tarmo.dat','HeaderLines',1); t.Var1=strrep(t.Var1,''''...

7 years ago | 1

Answered
Geomean on returns with negative values?
Use GR=100*(prod(1+R/100)^(1/numel(R))-1); where R is the rate of return for the period. Example: >> R=[9 1 2 3 -1]; ...

7 years ago | 1

| accepted

Answered
Linear fit to log x axis scatter and correlation calculation
You forgot to attach the data so made something up... x=1:10; y=sort(lognrnd(10,1,1,10)); b=polyfit(x,log10(y),1); yf=10.^po...

7 years ago | 0

Answered
Matlab Number Precision Affects the Results
Use ismembertol instead. And read up on floating point precision at <What Need to Know About Floating Point>

7 years ago | 1

Answered
How to do Table Look-up?
If all observations are extant but just missing some timesteps, then vars=unique(data(:,1),'stable'); % unique variable name...

7 years ago | 0

Answered
how to plot to get four plots of descriptive statistics in one figure
Revised to use the real data and the fitted statistics...as noted above, you can't represent these distributions at all fairly b...

7 years ago | 0

Answered
Importing data with unequal number of column
The problem is the file has embedded \n in what should be unbroken records. Whether this came from the original creation of the...

7 years ago | 0

Answered
How do i get my code to read the updated csv table instead of the old table?
It would be better to follow IA's suggestion of fixing the grades in memory and updating the file, but... Your logic error here...

7 years ago | 0

Load more