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

Answered
Event function not halting integration
Rather than making your event function return either true or false (or 1 or 0) that indicates whether the event function thinks ...

5 years ago | 0

| accepted

Answered
Matlab logical matrix to C char type
I can understand how you generate the 0x00 and 0xFF values from your logical data, but how do you generate the other values from...

5 years ago | 0

Answered
Why does the pca function in MatLab and on mathworks indicate different outputs?
You have a different pca.m that is taking precedence over the pca function included in Statistics and Machine Learning Toolbox. ...

5 years ago | 0

| accepted

Answered
How can I add the percentage result on plotted figure ?
FYI if you want the only marker to be at the highest point you could use MarkerIndices rather than plotting two separate lines. ...

5 years ago | 0

Answered
Byte Array / Bit Conversions in a Cell
If all your numeric data is the same type, I recommend storing it in a numeric array rather than as a cell array. Let's make som...

5 years ago | 0

| accepted

Answered
Import Keras Tensorflow model in to Matlab
See the importKerasNetwork function in Deep Learning Toolbox. As that documentation page indicates, you will also need a support...

5 years ago | 0

Answered
function - input and output matrix
My suspicion was correct. When you call load with an output argument, that output argument is a struct array with each variable ...

5 years ago | 1

Answered
Using a program designed function
You don't want to pass the names of the variables into your function, you want to pass the variables themselves. As a simplified...

5 years ago | 0

Answered
Creating index and replacing values
A = [0 0 1 0 1 0 0]; B = [ "030121", "030221", "030321"]; I'm going to assume that A does not start with 1, or if it does that...

5 years ago | 0

| accepted

Answered
Why my normpdf in not working??
Let's evaluate the PDF using the formula in the documentation for normpdf at that large x value. I'll choose the smallest value ...

5 years ago | 1

Answered
how to assign numbers to each row of a matrix? knowing that my matrix is 70x4 so that each row has an index from 1 to 70. Thank's
You already have, by storing your data in a matrix. A = magic(5) % Data associated with the number 3 A(3, :) If you have dif...

5 years ago | 0

| accepted

Answered
How to get quotient value after division without round off?
If one or both of the numbers are stored as an integer type you could use the idivide function. idivide(int16(157),2)

5 years ago | 0

Answered
Locating Antenna toolbox documentation
As stated on this documentation page: "MathWorks® reserves the use of packages named internal for utility functions used by int...

5 years ago | 0

Answered
improper integral: exp(ikx) undefined in Matlab?
What is the value of your integral when k is equal to 0? syms x k; assume(k,'integer'); k = 0; int(exp(1i*k*x),x,-inf,inf) ...

5 years ago | 0

| accepted

Load more