Answered
My Matlab take so long to start on AWS
There are a number of startup options. For example, using -nosplash will prevent that particular image from displaying. A good s...

18 days ago | 0

Answered
Why do I get more error bars than I defined?
For most of your points, you are not plotting no error bar; you are plotting an error bar with zero error. You could make the d...

18 days ago | 0

| accepted

Answered
I am trying to work out a volume given input values but it says theres an error ''Index must not exceed 1''?
This expression: NumberOfFloors(WidthOfFloors*LengthOfFloors*HeightOfFloors) is trying to index into the variable NumberOfFloo...

22 days ago | 1

| accepted

Answered
Dark Mode editor for MATLAB
UPDATE April 2022 - Please see this Answer for more details on dark mode: https://www.mathworks.com/matlabcentral/answers/167119...

22 days ago | 14

| accepted

Answered
Why isn't sum of logs == log of product?
They are equal to within double precision: log(3) + log(4) - log(3*4) There are many places on this forum that discuss this in...

23 days ago | 0

Answered
How to delete the first or the first two characters in a string?
In modern MATLAB parlance, 'W987' is a character array, not a string. @KSSV's answer is accurate in your case, but will not wor...

27 days ago | 0

Answered
How can I store the corresponding temperatures (T), specific volumes (v), and entropies (s) of a thermodynamics superheated table in MATLAB arrays.
I recommend using Tabula to extract the data from the PDF file into a text file or spreadsheet. Then there are a few ways to pu...

29 days ago | 0

Answered
Remove space in a string while parting data using sscanf.
Here is a radically different approach, using regexp instead of sscanf: tline = "Pressure Offsets: -0.206 ,-0.025,0.004 ,-0.0...

1 month ago | 0

| accepted

Answered
''Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-100'' error when updating my vector W
The way you have defined F1 = @(t,r)X; the result of this line W1 = F1(t(i),y(i)); is going to be W1 = zeros(1,100); Note t...

1 month ago | 0

| accepted

Answered
How to plot a graph with y-axis values that can be incremental?
In order to get a plot that looks like the blue line, you would need y data that gradually increases, levels off, then decreases...

1 month ago | 0

Answered
Make subplot 'stick' to each other
It might be easier to do what you want with the newer tiledlayout command for making subplots.

1 month ago | 0

Answered
Index exceeds the number of array elements.
There are a couple issues with your code. First, MATLAB's algorithm to automatically detect the file delimiter seems to have got...

1 month ago | 0

Answered
How to implement this random distribution operation with matlab(beta disturbution)
You can calculate the parameters of the beta distribution from the mean and variance. The formula for doing this is on the Wikip...

1 month ago | 0

Answered
Gaussian Fitting under peaks
If you have the underlying data the fitgmdist function in the Statistics and Machine Learning Toolbox does this sort of fit. Her...

1 month ago | 1

Answered
Hi. I want to create a random spatially correlated Gausiian 3D field. How to do that in Matlab?
It seems that this File Exchange submission might be helpful. It looks like it is 2D only, but perhaps you could adapt it?

1 month ago | 0

Answered
How to extract NaN values from matrix?
Here are two different ways: M = [2 3; 5 NaN]; Mvec = M(not(isnan(M)))' Mvec2 = M; Mvec2(isnan(Mvec2)) = []

1 month ago | 0

| accepted

Answered
How to plot variables with different array sizes?
Here is one way: figure hold on plot(t1,Y1) plot(t2,Y2) plot(t3,Y3) Another is: figure plot(t1,Y1,t2,Y2,t3,Y3) See the ...

1 month ago | 1

Answered
Imput a date without getting a nan
DateStrings = {'2021-05-26';'2021-08-03'}; t = datetime(DateStrings,'InputFormat','yyyy-MM-dd'); waveHeight = [2 3]; figure ...

1 month ago | 1

Answered
How to Cite Matlab 2022
According to Cite Bay (which I cannot directly vouch for), the citation style should be MATLAB. (2022). Version R2022a. Natick,...

1 month ago | 0

| accepted

Answered
Function not giving an output
This condition almost certainly does not do what you expect: (pt == (1 || 2) && (size(time) == 4)) The problem here is (at lea...

1 month ago | 0

Answered
when i plot a function, others disappear
All three lines are being plotted. The issue is that the green line goes to huge values, so you don't see the separation between...

1 month ago | 1

Answered
resize a matrix and missed data "zero"
Here is one way: M = [ 1 2 5; 80 50 60]; Mrange = M(1,1):M(1,end); Mexpanded = [Mrange; zeros(1,M(1,end))]; Mexp...

2 months ago | 0

Answered
Goal: Create a graph with 95% confidence intervals. Issue using patch.
It's unclear to me why you are doing the str2double and cell array manipulations on yCI95, but it works if you fix that up: x =...

2 months ago | 0

Answered
Calculating returns of a table structure and error operator '-' is not supported for operands of type 'table'.
You don't need to transform to a different variable class, but you need to use different syntax to access the contents of a tabl...

2 months ago | 1

Answered
3D plot using only data points, not a function
There are several options, for example mesh surf scatter3 Perhaps take a look at the MATLAB Gallery for something close to w...

2 months ago | 0

Answered
How do you host a web app to be publicly available and not rely local computer?
One solution is to run MATLAB on a cloud-based service such as AWS. Another possibility is to use the MATLAB Compiler to genera...

2 months ago | 1

| accepted

Answered
Legend colors match with plot
Here is one way to code this (assuming I understand what you meant): rng default N = 3; P=[0.35 0.25 0.2 0.15 0.10]; nElemMa...

2 months ago | 0

| accepted

Answered
I want to convert a single cell to a float number
I'm confused. The way you have defined celltest, the first element is already a (double-precision) floating-point number: cellt...

2 months ago | 0

Answered
Matrix calculation(replacing a new value instead of matrix element)
The code is doing what you expect, but the format of the output obscures the result. Try using format long, and you'll see the r...

2 months ago | 1

| accepted

Load more