Answered
How to find first instance of a value in array?
You could use logical indexing. rng('default') c = randn(1, 10) arr = abs(c) % Overwrite those values in arr that are out of...

5 years ago | 0

| accepted

Answered
Unable to resolve the name matlab.engine.start_matlab.
My interpretation of the two lines of code in the "Start MATLAB Engine" section of the documentation page to which you linked is...

5 years ago | 1

| accepted

Answered
How can I solve an error saying"length of lower bound is >length of (x) ignoring extra bounds "in ga multiobj
That was likely a warning (displayed in orange; errors are displayed in red) that the ga function thinks you did something wrong...

5 years ago | 1

Answered
What is the proper format to express ln z?
The natural logarithm function in MATLAB is log not ln. [There are log10 and log2 functions for base 10 and base 2 respectively....

5 years ago | 0

| accepted

Answered
Remove timestamps (date & time) that appear on every figure by default
Let's make sure first that no one has written functions that are taking precedence over the built-in graphics functions. Can you...

5 years ago | 0

Answered
Why are the attached .mat files not matrices? What are these files?
A, B, and E are sparse matrices. Only the non-zero elements and the row and column indices of those non-zero elements are stored...

5 years ago | 0

| accepted

Answered
How do I get the different maximum values of a plot where a peak has the same value several times.
Take a look at the islocalmax function.

5 years ago | 1

| accepted

Answered
How to use changing logical states in a MATLAB intregrator
It sounds from your description that the solution to your system of differential equations at a given time depends on the soluti...

5 years ago | 0

| accepted

Answered
where is Testing section on the Classification Learner tab as explained in documentation?
Which release are you using? Does the documentation for the Classification Learner app in the release you're using include that...

5 years ago | 1

| accepted

Answered
I want to plot a graph for a function which varies according to the range of the variable (Like a piecewise function)
You can operate on a vector of values using logical indexing with a mask for each of your conditions. % x data d = 0:360; %...

5 years ago | 1

Answered
Is there a way to comment out all unused lines in an automatically generated code at once?
You can use the block comment operators to comment out a section of code, or you could select the lines and use either the butto...

5 years ago | 0

Answered
s it possible to have double subscript in a figure label
I could have gone further but with smaller and smaller letters it gets more difficult to read. xlabel('A_{B_{C_D}}')

5 years ago | 1

Answered
Combine The Workspace Variable Name of a unit8 Variable with Value of a 1x1 Double to Create An Output Variable with a Combined Name
A tl;dr version of Stephen's comment: Can you do this? Yes. Should you do this? The general consensus is no. There are seve...

5 years ago | 1

| accepted

Answered
Sizeof double float int etc
I need something very similar with a matrix now. I will be storing bigger and bigger matrix and I need to find their size in the...

5 years ago | 1

Answered
Why is pre-allocating done?
See this documentation page for a brief discussion of why one may want to preallocate an array. Imagine you were building a hom...

5 years ago | 2

Answered
Extend the time vector of a TimeTable
See the retime function.

5 years ago | 1

Answered
Generic get/set methods for class properties
If all you're doing in your generic get and set methods are accessing the properties, you don't really need them. Just use dot i...

5 years ago | 0

Answered
online Matlab giving suddenly started giving error
Delete the variable you've created named mean that is preventing MATLAB Online from calling the mean function. You should also m...

5 years ago | 0

| accepted

Answered
xlim function error. i have seen on video, the codes were working but with me it is not working
I would expect to see that error if you'd plotted with non-datetime data as your X data. If for example you'd plotted these poin...

5 years ago | 1

Answered
Cannot update from "9.7.0.1190202 (R2019b)" to "R2019b Update 8" using the "Add-On Manager"
As the message suggested, please contact Technical Support and work with the Support staff to determine why the updating process...

5 years ago | 1

Answered
How to code block lanczos algorithm?
function [T]=bsymLanczos2(A,v,m) m=13; n=100; r = -5 + (5+5).*rand(n); A = triu(r) + triu(r,1)'; v=rand(n,2); % 2*2 block v...

5 years ago | 0

Answered
Operator '>=' is not supported for operands of type 'cell'
T = {[], datetime('tomorrow')} thor = {datetime('today')} T{2} <= thor{1} % false T{2} <= thor(1) % error The next-to-last l...

5 years ago | 0

Answered
I want to minimize a function, but it gives an error message "Conversion to logical from sym is not possible.". I would like to understand the reason behind it.
The fminsearch function requires the function handle that you pass into it as the first input to return a numeric array, not a s...

5 years ago | 0

| accepted

Answered
How take derivative d/dt(sinx), but have result be cosx * d/dt(x) ?
Tell MATLAB x is a function of t. syms t x(t) d = diff(sin(x), t)

5 years ago | 0

| accepted

Answered
Error in inline expression ==> Not enough input arguments.
As the documentation states "inline is not recommended. Use Anonymous Functions instead." Change your code to use an anonymous f...

5 years ago | 0

| accepted

Answered
How to save all variables in for loop
There are a few problems or concerns about the code you've posted. for i=length(com) This for loop body will execute exactly o...

5 years ago | 0

Answered
random letter bother upper & lower case
uppercase = 'A':'Z'; lowercase = 'a':'z'; letters = [uppercase lowercase]; whichLetters = randi(numel(letters), 1, 10) rando...

5 years ago | 1

Answered
Loop and Conditional Statements
As written your code calls atan at most once per element of u but then throws that result away. You also have magic numbers that...

5 years ago | 1

| accepted

Answered
how to deal with the array size limits problem?
You're asking for roughly 5 terabytes of contiguous memory. To put that into some context, in 2012 the English Wikipedia had abo...

5 years ago | 0

Answered
Auto-naming a variable based on imported file name
Can you do this? Sometimes. File names are not required to be valid MATLAB identifiers. I can have a file named "3 blind mice.tx...

5 years ago | 0

Load more