Answered
Take values greater than 0 excluding NaN
A = [NaN NaN 1; NaN -2 -3; NaN NaN NaN; 2 NaN -3; NaN -3 -3; 1 -1 0] % Adding an explicit 0 B = A; B(B <= 0) = 0; B(B > ...

4 years ago | 0

| accepted

Answered
n E Z => sin(n*pi) = -1 ?
Use the sinpi function. n = 100000000000000000000000000000; sinpi(n)

4 years ago | 2

Answered
Remove duplicate edges of undirected graph
Call simplify on your multigraph (you can tell if your graph or digraph is a multigraph using ismultigraph) to convert it to a s...

4 years ago | 0

| accepted

Answered
Plotting a multidimensional array (or a 3D matrix)
What type of plot do you want to create? Look at the thumbnails in the Plots Catalog (the Plots tab of the Toolstrip) and see on...

4 years ago | 0

Answered
Remove nodes in a graph based on label name instead of index
B = graph(bucky, string(1:60)); % Use '1' through '60' as names head(B.Nodes) % Show the first few node names B2 = rmnode(B, '...

4 years ago | 1

| accepted

Answered
undefined function error for builtin toolbox function
If this recurs in the future, you don't need to reinstall. Likely you had a directory on your MATLAB path that contains an imple...

4 years ago | 0

Answered
2D-Histogram with log y and x ticks
Instead of using hist3 I recommend you use histogram2. edges=2.^(-8:0) % Set the lower limit to be whatever will cover your dat...

4 years ago | 0

| accepted

Answered
Reading numbers from String
Yet another approach: str = {'SRm40_','SRp5_'}; str = replace(str, 'm', '-'); % Handle negative numbers str = replace(str, 'p...

4 years ago | 0

Answered
Create Categorical array for histogram on R2020a
I tried running those three lines of code in release R2020a and it produced the categorical histogram plot that I expected. Wha...

4 years ago | 0

Answered
I generated code in MLSL in R2022b pre-release and have this error "File could not be copied. LWS Export failed". How could I solve this issue?
Please send any questions or feedback related to a Prerelease of MathWorks products to Technical Support directly instead of pos...

4 years ago | 0

Answered
Alternative to 'findpeaks'
See the islocalmax function that is part of MATLAB.

4 years ago | 3

Answered
there is no output, it's keep running but no output, why so?
Let's look at the value of your integrand at the starting values. ti = 0; %inital time tf = 100E-4;% final time tspan=[ti tf]...

4 years ago | 1

Answered
Properties of Polaraxes in App Designer not working
As a high-level plotting function, by default polarbubblechart will reset most of the properties of the polaraxes to their defau...

4 years ago | 0

| accepted

Answered
Choosing the best algorithm for fmincon
I haven't seen anywhere the ability to assign first-order optimality to a variable. Take a look at the documentation for the ou...

4 years ago | 0

| accepted

Answered
Ordinary differential equations for a buckled column
The "Solve Nonstiff Equation" example on the ode45 documentation page bears some resemblance to your ODE if you replace in the ...

4 years ago | 0

Answered
Plot one data set with two different units?
Let's plot some sample data on the left axes. yyaxis left plot(1:10) Now add a right axis. yyaxis right Change the Y limits...

4 years ago | 0

Answered
Wrong behavior of symbolic number creation in R2022a
Did you change your symbolic preferences without realizing it? sympref('FloatingPointOutput',true); x = sym(1/3) sympref('Flo...

4 years ago | 0

| accepted

Answered
How to use xline?
The ability to create multiple vertical or horizontal lines by passing a vector of values into the xline or yline functions was ...

4 years ago | 0

| accepted

Answered
Storing a Matrix Output in a matrix
You have 4220 (= 844*5) eggs and an egg carton with 844 cups. How can you fit all 4,220 eggs into 844 cups (and no, scrambling t...

4 years ago | 0

| accepted

Answered
I'm new to Matlab and still learning, how do I go about solving this problem in simple terms?
initial=1000; month = 1:1:120; You don't want this to be a vector. Make it a scalar (one number) that represents the month who...

4 years ago | 0

| accepted

Answered
Error in svd in r2018a
Are you using Update 3 of release R2018a or a later Update, or are you using release R2018a (no Update) or Updates 1 or 2? If y...

4 years ago | 0

Answered
[ ] or ( ) in constructing array
The fastest and most bug-free piece of code you can write is the one that doesn't exist because it doesn't need to exist. When ...

4 years ago | 2

Answered
"Sort 3_D array along the third dimension"
If you look at the pictures in the description of the dim input argument on that page, note that the arrows go down along the co...

4 years ago | 0

| accepted

Answered
Not pausing on error in unit test
I believe that the test infrastructure runs your tests effectively in a try / catch block and so an error breakpoint set to paus...

4 years ago | 0

Answered
How can one make this extraction?
I have a 3-D array where the first column is month, the second column is city, and the third column is a vector of temperature o...

4 years ago | 0

| accepted

Answered
How to create Plot button for Complex vector?
I am fairly certain that it is not possible for users to register their own plotting functions for inclusion in the Plots Catalo...

4 years ago | 1

Answered
Why are all Run options are greyed out?
What happens after you save the Live Script? That asterisk next to the file name indicates it's "dirty", it has unsaved changes....

4 years ago | 0

Answered
Discrepancy in Matlab documentation between code and webpage content for GPS Waveform Generation example
The page on the website, which is part of the documentation for the current release (right now that is release R2022a) does appe...

4 years ago | 1

| accepted

Answered
Are the neural network training methods (like train(), or trainlm()) supported by codegen and App Compiler?
Looking at the documentation page for the shallow neural network train function in Deep Learning Toolbox, it does not have an Ex...

4 years ago | 0

Answered
Matlab Integral function for a self teaching beginner
By default, integral calls the integrand function you pass into it with an array of data, not just a scalar. It requires your in...

4 years ago | 0

Load more