Answered
why my conditional function is not what I expected?
if X>=0 & X^2+Y^2<4 From the documentation for the if keyword: "if expression, statements, end evaluates an expression, and exe...

3 years ago | 1

Answered
Why isn't my figure consistent? It keeps changing every time
Here's one line of your code. I've put it in block comments so MATLAB Answers won't try to execute it, since I have other code l...

3 years ago | 0

Answered
Matlab coder support for fitdist
In general we don't comment on future plans. I recommend that you submit this as an enhancement request to Technical Support. If...

3 years ago | 0

| accepted

Answered
imhist and histogram giving different results
I suspect that imhist and histogram are just using different algorithms to select the bin edges in the case where you only speci...

3 years ago | 0

Answered
How to change folders in MATLAB App Designer ?
I would advise you to use fullfile to assemble your file paths rather than concatenation. I'd also be wary about assuming that p...

3 years ago | 1

Answered
Issue with N body problem using ode45
Are you certain on those satellite masses? Looking at Wikipedia the mass of the Great Pyramid of Giza is 6e9 kg. Are these satel...

3 years ago | 0

Answered
How to convert column datetime (yyyy-mm-dd HH:MM:DD.000) into MJD and decyear?
According to Wikipedia the modified Julian date is the number of days since November 17, 1858. It is also the Julian date minus ...

3 years ago | 0

Answered
Error using the 'square' interpolation method in interp1 function
I don't believe there was ever a 'square' interpolation method in interp1. But the input argument checking in much older version...

3 years ago | 2

Answered
What is the legal status of code examples on mathworks.com?
Please contact Customer Service for an official answer to legal questions about MathWorks examples.

4 years ago | 1

| accepted

Answered
how to display newline
If you're using release R2016b or later you can use the newline function, perhaps in conjunction with a string array. s = "appl...

4 years ago | 5

Answered
I cannot use "binornd" or "random" function
Both binornd and random are functions in Statistics and Machine Learning Toolbox. Do you have this toolbox installed and license...

4 years ago | 0

| accepted

Answered
Issue with finding the indices of the minimum element in a 3-Dimensional Array
Use the 'all' dimension argument and the 'linear' index argument to obtain the linear index of the maximum of the array consider...

4 years ago | 1

Answered
I don't understand the behavior of discretize
The calculated edges make no sense, and the output is clearly bins of non-uniform width. No, in that example the bins are unifo...

4 years ago | 0

Answered
How to get user homepath?
Does getenv do what you want?

4 years ago | 0

| accepted

Answered
function in a script file
You cannot define a function inside an if statement. You can define a function in a script or function file outside of the if s...

4 years ago | 0

Answered
Creating funcing in spesific formats
Take a look at the format function.

4 years ago | 0

Answered
Where is plotSlice?
How are you calling plotSlice? According to the documentation page plotSlice requires its input to be a "Linear regression model...

4 years ago | 0

| accepted

Answered
How to write an quadratic.m function
I assume you've saved this in a file named QuadraticEquation.m. If so you just need to rename the file to quadratic.m and ideall...

4 years ago | 0

Answered
Remote matlab running: changing folder and running script
Instead of piping the contents of the file to MATLAB, use the -batch or -r startup options in conjunction with the -sd startup o...

4 years ago | 0

| accepted

Answered
Renaming .mat file
Use the movefile function.

4 years ago | 1

| accepted

Answered
GA - objective and constraints have to run the same expensive function
One potential solution would be to memoize your expensive function, pass the memoized function into your objective and constrain...

4 years ago | 0

Answered
Plotting 2D contours syntax
I am mainly concenred with having the "dot" after the variable. The dot is not associated with the variable, it's associated wi...

4 years ago | 0

| accepted

Answered
Deterministic SEIR ODE model running slow
The first thing I'd probably try is to use a stiff ODE solver instead of the nonstiff ODE solver ode45.

4 years ago | 0

Answered
How do I bin my X and Y data to plot the mean and SD?
X=[1 2 2 3 4 4 4 2 1 3]; Y=[0.1 0.3 0.31 0.36 0.5 6 6 0.32 0.11 0.38]; row = 1:numel(Y); accumarray([row(:), X(:)], Y)

4 years ago | 0

Answered
I have issues using datenum function because of a different date format on excel, how can I modify my dates in matlab and then run the function?n
Don't use serial date numbers and datenum. Use datetime instead. s = "12:34:56, 30 08 2022" fmt = "HH:mm:SS, dd MM yyyy"; dt ...

4 years ago | 1

| accepted

Answered
Date time conversion fail
I would like to conver a time to num format so i can do some basic math on it What math do you want to do to the time data? Th...

4 years ago | 0

Answered
Animated line and moving markers with different, changing colors
I advise you not to use handle as a variable name, as it already has a meaning in MATLAB. When you call scatter, since you didn...

4 years ago | 1

| accepted

Answered
where can I get the supporting file "helperViewDirectionAndDepth.m" for Monocular Visual Simultaneous Localization and Mapping?
If you have a sufficiently recent release of Computer Vision Toolbox installed, click the Copy Command button on that example pa...

4 years ago | 1

Answered
matrix operation to scalar
Don't overwrite your vector variable with a scalar value then attempt to use it as though it were still a vector. If you have a...

4 years ago | 0

| accepted

Answered
OOP: objects as properties of objects; objects with no methods; objects with no properties?
Is it OK to store other objects as properties of an object? Yes, but you will need to be careful in certain situations (most no...

4 years ago | 0

Load more