Answered
Help using tiledlayout and nexttile functions
It's unclear to me what you are expecting to get, but this code works exactly as I would expect. You have defined an 8x2 grid o...

2 years ago | 0

| accepted

Question


How to get sample datasets locally? [Documentation error?]
Now that documentation is offline by default, it seems that the sample datasets mentioned on this documentation page are no long...

2 years ago | 1 answer | 0

1

answer

Answered
Understanding the following step in MATLAB
The line symbols = randi([0 3], 1, 256) generates random values from the values [0 1 2 3]. Those zero values are not a valid i...

2 years ago | 1

| accepted

Answered
Add data from one matrix to another by the values of one column
C1 = { 1000 [10370;10371;10372] 1001 [12933;12934] 1002 10001 2000 11320 2001 [11347;11348] 2002 [10362;10363] 2003 [1263...

2 years ago | 0

Answered
Standard Deviation for X,Y data over 30 Years
I agree with @dpb's comment. The only other thing I can think of is that the syntax std(A,[],3) which seems to be equivalent t...

2 years ago | 0

Answered
How to use groupsummary to group by hour-of-year
The groupbin option "hour" doesn't do what you want? (If not, can you upload a sample of input and output data indicating what ...

2 years ago | 0

Answered
Linear FillMissing producing incorrect values?
User error (or, really, misinterpretation). Although the result happens to be half, the process is not to just take half of the...

2 years ago | 1

| accepted

Answered
The best approach to avoid the Kullback–Leibler divergence equal to infinite
Your question is not really a MATLAB question, but a math/stats questions. (At least, it seems you already understand how to rem...

2 years ago | 2

Answered
salve one field in the same struct is possible?
I believe that save('vv','-struct','A','d','-append') will do what you want

2 years ago | 1

| accepted

Answered
I have a 5x6 matrix. I want to calculate sum of only those values which are consecutive nonzero along each row. How to do that? The desired result given in description box.
I believe this does what you want: % Input a = [2 3 1 4 0 0; 0 0 0 0 0 0; 0 0 1 5 7 0; 0 0 0 0 4 0; 4 ...

2 years ago | 0

| accepted

Answered
How to calculate the date 0.25 years after the date of January 15, 2020
The behavior might not be what you expect, but it is what is documented for the years function: "If X is a numeric array, then ...

2 years ago | 0

Answered
linear vs nonlinear regression model
Whether a model is linear or not refers to the coefficients being solved for (a, b, c), not the data (x, x1, x2).

2 years ago | 2

Answered
How do I make a graph for newton raphson?
I edited your anonymous functions to use element-wise multiplication (.*) instead of matrix multiplication (*). % Newton Raphso...

2 years ago | 1

| accepted

Answered
NEED HELP, I want to obtain the following array.
Assuming that the answer to @Walter Roberson's question is "the size is always a multiple of 4", then % Make up some input data...

2 years ago | 0

| accepted

Answered
Hello everyone, I have date and time data in an excel separately. That is, year in one column, month in another, day in another column, and time in another column. how can i r
Here is one way: dateTbl = readtable("dateFile.xlsx"); dateData = datetime(dateTbl.Var1,dateTbl.Var2,dateTbl.Var3,dateTbl.Va...

2 years ago | 1

| accepted

Answered
Dimensionality error with plot
I understand your confusion. pressureData(1,1,:) is a vector in the sense that it only has elements along one dimension (the 3rd...

2 years ago | 0

| accepted

Answered
Fit a statistical distribution to truncated data
I haven't used it much, but this File Exchange submission seems to do a pretty good job. pd = makedist('Normal','mu',3); t = t...

2 years ago | 2

Answered
Could anyone give me more information about this vergin of Matlab?
MathWorks releases two versions per year, named (for example) R2022a and R2022b. The most recent release is R2023a. If I have co...

2 years ago | 0

Answered
Why does polyfit gives two outputs?
The first line of the function description on the documentation for polyfit states precisely what those outputs are. They are t...

2 years ago | 1

Answered
Rename folders using folder names saved in cells
Here is one way: cell_numbers = {2;10;22;48}; cell = {'parameter_1';'parameter_2';'parameter_3';'parameter_4'}; % <---- You sh...

2 years ago | 0

| accepted

Answered
How to switch the indexing order
There's probably no way that isn't somewhat awkward, but here is a function that will convert a column-major index (which is wha...

2 years ago | 0

| accepted

Answered
Plot with x-axis limits going from [180:360] then [0:180] contiguously
You only give one example, and this will do what you want for this one example. It does not touch your data, just what is plotte...

2 years ago | 0

Answered
How to extract the X and Y values from a contourf graph
The problem is that you set the levels input to contourf to [1 1], but it is impossible to have contours there, because all your...

2 years ago | 0

| accepted

Answered
Need advice for coding dummyvar vectors - Regression
The documentation for fitglm states "If data is in a table or dataset array tbl, then, by default, fitglm treats all categorica...

2 years ago | 0

Answered
how to determine that all cell array value exists in other cell array?
This does what I think you want: S = {[29 56 62]; [34 40 62]; [48 52 7]}; T = {[1 3 5 7 9 11 13 15 17 19 21 23 ...

2 years ago | 0

| accepted

Answered
all function B = all(A < 0.5,3)
The reason is that all MATLAB arrays have implied singleton dimension beyond the 2nd dimension, if they have not been actually s...

2 years ago | 2

Answered
Applying a K-Fold cross validated model to predict the response variable for new data
Immediately after writing my comment above (which is still true), I think I see the answer without the additional info. For k-f...

2 years ago | 0

Answered
How can I extract a number in a string before a certain character
str = "Var.[100-200, 4000-5000]"; regexp(str,"\d*(?=-)","match") Matching regular expressions can be a bit inscrutable at fi...

2 years ago | 1

Answered
Generate a cube with length 2*r, then split the cube into 100^3 equally spaced 'little cubes'
Your problem is mathematically equivalent to generating n=500 random numbers from 1:(100^3) numbers, where each number correspon...

2 years ago | 1

| accepted

Answered
Why won't datetime work for 0:00?
It's not easy to debug this without seeing the data, but I would suggest explicitly adding a 'Format' Name-Value input to this l...

2 years ago | 2

Load more