Answered
pause function gives inconsistent timing when used inside a loop.
Careful using tic/toc. As summarized in the documentation, "If your code is faster than 1/10 second, consider measuring it runn...

6 years ago | 1

| accepted

Answered
Why after programming the coeff of the dataset, I get only part of the coeff of the dataset?
From the documentation: coeff = pca(X) returns the principal component coefficients, also known as loadings, for the n-by-p dat...

6 years ago | 0

| accepted

Answered
How to designate color in contour plot with specific values
Here's a demo. Produce the contour plot. Set the binaryThreshold variable that defines the border of white/black Redefine t...

6 years ago | 0

| accepted

Answered
How to set a fix aspect ratio in app designer plots
axis(app.UIAxes, 'equal')

6 years ago | 1

| accepted

Answered
Removing empty cells with non-zero dimensions
How to remove empty cells To remove all empty cells in the 2nd layer of a nested cell array named X, for i = 1:numel(X) ...

6 years ago | 0

| accepted

Answered
Removing columns if single value is more than threshold
" I would like to remove whole columns, if any value is for example 10% greater or less than row average" Demo: % Create 100x1...

6 years ago | 0

| accepted

Answered
Theta marked in radians for ezpolar?
polarplot uses polaraxes whereas expolar creates a pseudo-polar-plot on regular Cartesian axes. The ThetaAxisUnits property is ...

6 years ago | 0

| accepted

Answered
selection of 4 consecutive rows from a matrix randomly
Select a random integer from 1 to n-j+1 where n is the number of rows and j is the number of consecutive rows to select. m = ...

6 years ago | 0

Answered
App Designer terminate an execution of a function
Since Matlab does not have a "kill all tasks" command, you can continuously check the value of a flag within the function and st...

6 years ago | 1

| accepted

Answered
How to replace arrays containing consecutive repeated numbers by zero?
For some reason I'm drawn to detecting / counting consecutive numbers. I must have answered more than 5 questions similar to th...

6 years ago | 2

| accepted

Answered
How to plot result from fitnlm?
Demo: plotting fitnlm results with two predictors This demo supplements Star Strider's answer by showing how to plot fitnlm() r...

6 years ago | 0

Answered
Creating Timetable from Excel for Driving Cycle.
Create the timetable opts = detectImportOptions('GPS Cycle.xlsx'); opts.VariableTypes = {'double','datetime','double','double...

6 years ago | 0

| accepted

Answered
Mean value of a subarray
The answer in this link computes segmented averages as you describe except instead of averaging 1:8, 8:15, ... , it averages 1:8...

6 years ago | 0

| accepted

Answered
How to wait for a button to be pressed?
Place this in the line where you want execution to pause uiwait(handles.figure1) % use your figure handle Then, from within t...

6 years ago | 0

Answered
Why does corr function result depend on the number of columns ?
Understanding the output of rho=corr(x) r = corr(x,x); is the same as r = corr(x); If a single value is changed in x in col...

6 years ago | 0

| accepted

Answered
How to plot a histogram in a waterfall plot?
The bars will have to have a width value but you can make that value very small to appear as flat. For bar3(Z), when Z is a m...

6 years ago | 1

Answered
how to use cells as xlabel in stackedplot
First convert your matrix to a table and use the variable names in your cell array. T = array2table(x, 'VariableNames', varNa...

6 years ago | 0

| accepted

Answered
MATLAB app designer close during running
Open the problematic app in appdesigner using r2019b (or whichever release you plan on using). When an app is developed in one ...

6 years ago | 0

Answered
Subplot Titles left justified
Prior to Matlab r2020b Set the title's units to Normalize Move the title leftward Set the title's HorizontalAlignment to Left...

6 years ago | 4

| accepted

Answered
How can I draw equations I found on WolframAlpha in MatLAB?
You must convert the mathematical notation to a syntax recognized by Matlab. For example, this segment, becomes any of the...

6 years ago | 0

| accepted

Answered
Give focus to an Edit Field
In MATLAB R2022a and later Using AppDesigner in MATLAB R2022a and later, control tab/focus order in AppDesigning using the new ...

6 years ago | 3

Answered
How can I delet a point in Uiaxes thats Handlevisibility is set to 'off''
Control what appears in the legend without setting HandleVisibility to off. Use object handles to specify what belongs in the...

6 years ago | 0

| accepted

Answered
Histogram won't plot decimals
The problem is likely caused by at least one of the elements in column 4 that is not numeric. The non-numeric value could be pa...

6 years ago | 1

Answered
Why a linear model cannot be plotted in app designer?
This issue has been fixed in MATLAB R2023b Starting in MATLAB R2023b, provide the axis handle as the first input to plot the fi...

6 years ago | 3

| accepted

Answered
How to set colorspace of line in special code of graph?
Change the color of all graph edges plot(G, . . ., 'r') % red plot(G, . . ., [.5 0 .5]) % purple Change the colors of...

6 years ago | 0

Answered
GUI, make a handle disappear
"I want to achieve that when clicking both pink clickboxes I want to make all the red handles disappear. " The function you sha...

6 years ago | 0

| accepted

Answered
How can I extract X and Y from gauss2 fit or any other fit (poly2, poly 3, ...)?
The fit function merely fits your pre-existing (x,y) values and returns a fitobject that contains parameter values you can use t...

6 years ago | 0

| accepted

Answered
How to use impixel in UI created in App Designer
As of r2020a, impixel() is not supported with uifigures (e.g. AppDesigner; see Graphics Support in App Designer). Workaround ...

6 years ago | 1

Answered
How to find point of intersection of lines given y value
For each line, 1) Compute the slope of the line using the standard slope forumula. m = (y(2)-y(1)) / (x(2)-x(1)); 2) Compu...

6 years ago | 0

Answered
how can I define a global variable in app designer?
There are very few reasons, if any, to use global variables in apps and it's usually the sign of trouble. If the variable is m...

6 years ago | 3

| accepted

Load more