Answered
How can I define a function handle with 50 very similar functions?
You can't use a for loop in an anonymous function, but the good news is you don't need to. The diff function returns the differe...

3 years ago | 0

Answered
Who have visibility graph algorithm (Matlab code)? I'm looking for the code but have not found it.
If you're trying to solve this problem where your data is elevation data and you have Mapping Toolbox available see this documen...

3 years ago | 0

Answered
How do I create a random number generator using congruent method
If this is not for a homework assignment, either use one of the existing random number generators in MATLAB (as listed on this d...

3 years ago | 0

Answered
Problem with the use of strrep command
That is correct, when called with a cell array with some char vectors in the cells as input strrep requires each element of that...

3 years ago | 4

Answered
Error in interp1 (line 186) F = griddedInterpolant(X,V,method);
although the angles of attack are sorted Have you confirmed that this is true or are you just assuming that this is true? Call...

3 years ago | 0

| accepted

Answered
Problems running the code in Mac
Indexing into a char array using {} is not supported on any platform. a = 'abracadabra' a(5) % 'c' a{5} % error Perhaps your...

3 years ago | 0

Answered
Undefined function 'geomean' for input arguments of type 'double' in Matlab 2020
The geomean function is part of Statistics and Machine Learning Toolbox. Do you have this toolbox installed and licensed? You ca...

3 years ago | 1

| accepted

Answered
unable to run the program becuase of matrix multiplication error, also need to add a 3d earth around which the plot of orbit displayed.
Get rid of these lines from your script. If you need to clear the Command Window, close all figures, or clear all variables and ...

3 years ago | 0

Answered
Looking for packages available for multiple imputation (for missing data) in Matlab
Does the fillmissing function provide the method or methods you want to use to fill the missing values in your data sets? If not...

3 years ago | 0

Answered
Why are some functions listed as not compatible with MATLAB Compiler, when they are in fact used and compilable in the Simulink Standard Library?
Some functions and functionality is supported with MATLAB Compiler but not Simulink Compiler. Some functions and functionality ...

3 years ago | 1

| accepted

Answered
The code works but it gives this warning. How to remove this warning?
Looking at the contents of the attached L2_Array1.m: textOfFile = readlines('https://www.mathworks.com/matlabcentral/answers/up...

3 years ago | 1

| accepted

Answered
find the closest datetime
Let's make some sample dates and times within two-ish days of right now. n = 10; rightNow = datetime('now') A = rightNow + ho...

3 years ago | 1

Answered
Matlab HDL coder error: reptmat is not supported, but in the documentation it is.
There are different implementations of repmat for numeric arrays (the documentation to which you linked) and for fi arrays. Note...

3 years ago | 0

Answered
matlab -batch jobs are killed on Ubuntu without trace of reason
Are your jobs consuming a lot of memory? I'd check the syslog file to determine if the Out of Memory killer killed MATLAB to try...

3 years ago | 0

Answered
How can I plot my solutions in my phase portait?
You may be interested in specifying the OutputFcn option in your ODE solver call. The odephas2 function included in MATLAB may d...

3 years ago | 0

Answered
The MATLAB function to solve implicit equation
@John D'Errico posted how to solve this equation symbolically, if you don't have values for the various symbols used in the code...

3 years ago | 0

| accepted

Answered
Array not compatible error
For these types of errors, where data isn't the size you expected it to be, I'd use error breakpoints. Set an error breakpoint u...

3 years ago | 0

Answered
How do I pass input arguments to a compiled executable and define the output arguments that the user can see?
See this documentation page. Defining input arguments is relatively straightforward. For output arguments see the "Using a MATLA...

3 years ago | 0

| accepted

Answered
For the very same code memory is not released after a "clear" on Ubuntu but is on Windows
I suspect that the Out of Memory Killer is what killed MATLAB on your Ubuntu machine. See this webpage for more information and ...

3 years ago | 0

Answered
How to run the 'matlab -batch ...' with a different Matlab version
Try launching the MATLAB executable directly in bin rather than the one in the $ARCH subdirectory under bin. "D:\Matlab\R2021b\...

3 years ago | 4

| accepted

Answered
access matlab figures by opening them with a mouse while a matlab terminal application is still running
Because the program is running, after the user uses one of the menu options to make some plots that now exist in the working dir...

3 years ago | 0

Answered
How to do multiple divisions in order to generate another array?
All but two of your lines follow a pattern. I've commented the relevant lines out here so I can run code later in my answer. %{...

3 years ago | 1

| accepted

Answered
Assign a row vector to a row of an array using logical indexing to omit certain values
In many places in MATLAB, the values 0 and false can be used interchangeably. x1 = 5+0 x2 = 5+false Indexing is one of the ex...

3 years ago | 0

Answered
comparision of data with logic given as input
Can you dynamically create and operate on variables with numbered names like T1, T2, T3, etc.? Yes. Should you do this? The gen...

3 years ago | 0

Answered
I keep getting a "convenc" error. Line 88. Could be "varargin" missing argument? Not sure.
If you're calling the convenc function from Communications Toolbox, the section of that documentation page that describes the ms...

3 years ago | 0

Answered
How to access external variables in other workspace? (fmincon function)
Don't use global variables. Parameterize your nonlinear constraint function instead. If you define your constraint function as: ...

3 years ago | 0

Answered
Trend lines with moving average
My first thought would be to try using the Remove Trends Live Editor Task or the trenddecomp function.

3 years ago | 0

Answered
How can I randomly excuted for loops inside MAIN FOR LOOP instead of run them in ordered ?
Another possible solution to the problem, if you want to run a series of functions in a loop in a random order, is to use a cell...

3 years ago | 1

Answered
Can I call index of max function out and before the function ?
There's another problem with your code above and beyond what Walter described. If you want to call the max function inside your ...

3 years ago | 0

Answered
Find logical and (&&) for string array
That should work as long as the string arrays you're using in your comparisons are scalars. arrayX = "Left"; arrayY = "Right";...

3 years ago | 2

| accepted

Load more