Answered
converting a program to function
Determine which variables are inputs and outputs. Then assign them in this manner: function [out1, out2, out3] = yourFunctionN...

6 years ago | 0

Answered
How can I script this ?
Hint: A>10 B(A>10)

6 years ago | 0

Answered
Simultaneously use two set of data ( x and y) in the same equation
x .* (exp(-y))./1 % ^ ^ This will perforum element-wise math. When you add the results using sum() the result wil...

6 years ago | 0

Discussion


National volunteer week: Standing on the shoulders of giants
This week is <https://www.pointsoflight.org/nvw/ National Volunteer Week> in the USA and Canada and to celebrate, I’d like to pa...

6 years ago | 11

Answered
How do I update YData of multiple subplots?
h1 is an object on subplot(3,1,1). subplot(3,1,1); h1 = plot(t, RecBuf(:,1)); Then you clear everything from that subplot usi...

6 years ago | 0

| accepted

Answered
How to plot to two figures simultaneously?
Create the subplots and then copy each subplot axes to an independent figure at full size. Here's a demo. % Create subpl...

6 years ago | 1

| accepted

Answered
Data gap finding in a time series
Compute start and stop indices for NaN segments in height variable (column vector). nanStartIdx = find(diff(isnan([0;height;0]...

6 years ago | 0

| accepted

Answered
elseif to switch statement
There's nothing wrong with the if/elseif/else syntax but the conditional statements could be tightened up. If you prefer a swit...

6 years ago | 0

| accepted

Answered
Custom grid on a plot
If the x-axis is a datetime axis, compute the 15th of each month and use plot(), line(), or xline() to plot vertical lines on th...

6 years ago | 1

| accepted

Answered
How to plot something like this plot?
Here's a demo. I've chosen to use radians but you can use degrees with a few changes. See inline comments for detail. % For...

6 years ago | 1

| accepted

Answered
how to take a number as input
You can create an input dialog box using answer = inputdlg(prompt,dlgtitle) (see that page for additional input options). The ou...

6 years ago | 1

| accepted

Answered
Remove last row from csv using csvread
If you must use csvread() and you know the rows and columns of the file that should be read, use the following syntax to limit t...

6 years ago | 1

| accepted

Answered
Convert seconds to hours/minutes
Convert the numeric representation of seconds to durations. % x are you seconds values s = seconds(x); Change the duration ...

6 years ago | 3

| accepted

Answered
How to get a continuous line through two scatter plots
Compute the slope between the two points using the slope equation, m = (y(2)-y(1))/(x(2)-x(1)); Compute the y-intercept by fi...

6 years ago | 0

Answered
How can I change the marker size in legend?
How to create legend components that are customizable Copy the plotted objects and replace their (x,y,z) coordinates with NaN v...

6 years ago | 7

Answered
How to enlarge legend marker size?
The legend components cannot be independently changed. A workaround is to duplicate the objects on your plot but replace their ...

6 years ago | 0

| accepted

Discussion


New in r2020a: leap seconds
New to r2020a, |<https://www.mathworks.com/help/matlab/ref/leapseconds.html leapseconds()>| creates a table showing all leap sec...

6 years ago | 6

Submitted


quiverRotate
Rotates the direction of quiver arrows produced by quiver().

6 years ago | 1 download |

0.0 / 5
Thumbnail

Answered
Two separates custom data tips functions in the same GUI
The datacursormode and its update function is applied to the entire figure but you can assign different update function response...

6 years ago | 0

| accepted

Answered
projectile motion in matlab
If I understand correctly, the barrier is a vertical line defined by (x0,y0), (x0,y1) which are the bottom and top coordinates. ...

6 years ago | 0

Answered
How can I make the following plot?
Use bar(x, y, 'stacked') where x are datetime values (or integers for years) and y is a matrix where each row defines the stacke...

6 years ago | 0

| accepted

Answered
Output argument 'answers' (and maybe others) not assigned during call to "..."
Any time you write if... elseif... statements you should always include a final else statement, even if you think you've covered...

6 years ago | 0

Answered
cross correlation using 'xcorr' in the presence of NaN or missing values
There isn't a simple solution to this problem. If you have a single NaN value within the window, the correlation for that windo...

6 years ago | 1

Answered
Problem Using groupsummary function
The error message tells you the problem: A grouping variable of class 'table' is not supported. This line, zt=table(table1,t...

6 years ago | 0

| accepted

Answered
avarage running time problem
Here are three ways to use tic/toc to measure the timing of a loop. Each method has pros and cons. Method 1: Least overhead ...

6 years ago | 0

| accepted

Answered
Creating a binary image with rgb values
Use imbinarize(). The output can be used to determine whether the center pixel is black (0) or white (1). BW = imbinarize(. . ...

6 years ago | 0

Answered
Fill the color in the plot
patch(t1, x, 'b') ylim([-1 2])

6 years ago | 0

| accepted

Answered
Contour Plot Flow Direction
Follow this demo. If you get stuck, show us what you've got and we can help you get un-stuck. https://www.mathworks.com/help/...

6 years ago | 0

| accepted

Answered
Question about rmoutliers () function
Outliers using the quartile method are usually identified as values greater than Q3+1.5*IQR or less than Q1-1.5*IQR where IQR is...

6 years ago | 1

| accepted

Answered
Delete uiprogress object at the end of startup function
The uiprogressdlg outputs a handle to the progress bar. To delete the bar, d = uiprogressdlg(h); delete(d) to reset it to ...

6 years ago | 0

| accepted

Load more