Answered
repeat elements of row matrix li [1 2 2 3 3 3 4 4 4 4 n...... n times]
If you want the output to be character vectors, n = 12; y = arrayfun(@(n){repmat(num2str(n),1,n)},1:n); % Output Sample: ...

6 years ago | 1

Answered
How can I change the elements to zero when they are less than specific threshold
A(A<5) = 0; A(A<=5) = 0; B = A .* double(A>5); B = A .* double(A>=5); Try them out and choose one.

6 years ago | 1

| accepted

Answered
What's the diameter of the standard circle marker 'o' in scatter3 plot ?
The size of scatter objects are in point units where 1 point equals 1/72 inch. Plot a single point and look at it's SizeData....

6 years ago | 0

| accepted

Answered
App Designer - confirm exit when application is closed from Windows bar
Add a close request function to your app that requires confirmation. 1. From AppDesigner > Design View, right click the figure...

6 years ago | 9

| accepted

Answered
str in a IF statement, PLEASE HELP
Why do you have a loop when the instructions ask for a single value? The use of break usually indicates inefficient coding. Ag...

6 years ago | 0

Answered
how to extract large number of data points from 2D plot
If you can reproduce the figure, just save the coordinates in addition to plotting them, plot(x,y,'o') save('coordinates.mat'...

6 years ago | 0

Answered
How many colors with their name present in the image.
Here's how I explored your image data just-for-fun because I found it intersting and my solution to finding the number of colors...

6 years ago | 1

| accepted

Answered
How to get handle from currently running app made in App Designer?
3 ways to access an existing app In these examples the app's name is "MyApp". 1. Store the app handle when opening the app. ...

6 years ago | 3

Answered
Explicit indices for k-fold partitioning
Perhaps something like x = 1:100; % demo vector k = 5; % 5-partitions folds = cell(k,1); for i = 1:k folds{i} =...

6 years ago | 0

Answered
Gaussian Function Formula, cftool app.
a1 is an amplitude parameter defining the height of the guassian. b1 is the "mu" parameter defining the center. c1 is the "s...

6 years ago | 1

Answered
How to use matlab debugger
Matlab's factorial() function is being called somewhere when your code is executed. cumprod is a variable within factorial.m. ...

6 years ago | 0

| accepted

Answered
Invalid first data argument
All of the name-value pairs must come after all other input arguments. plot3(___,Name,Value) The first syntax is accepted bec...

6 years ago | 1

| accepted

Answered
How to avoid using for loops when declaring functions in a cell array
You only need 1 anonymous function if you include ii as a second input. ii must be a column vector and x must be a row vector. ...

6 years ago | 0

Answered
Compare two array values that meet criteria
Your example only contains 1 close-match of values between A and B that are +/- 15 units apart. % Raw data; A and B can be an...

6 years ago | 0

| accepted

Answered
The plot draws at y = -20, is there any way to force it to plot like normal (y=0)?
We don't have nearly enough information to understand what's causing those results. Shots in the dark include. You're using ...

6 years ago | 1

| accepted

Answered
how can I plot several vertical lines in graph?
In Matlab r2018b or later, you can use xline() to plot vertical lines or yline for horizontal lines. In MATLAB R2021a or later...

6 years ago | 1

Answered
How to fit linear regression models to a scatter graph
For a simple linear regression with a single predictor variable, you can plot the regression line using mdl = fitlm(tbl,'Mass~L...

6 years ago | 1

Answered
Adding years to my plot
This values 0:50 are probably indices (note that the first data point does not start at x=0). They could be durations too, I su...

6 years ago | 0

Answered
Matching string from multiple arrays
Here's a demo that identies exact datetime matches. It assumes you've already converted the timestamps to datetime values inste...

6 years ago | 0

| accepted

Answered
Obtaining the index of elements that belong to group
See the second output of datasample to get the selected index. [y,idx] = datasample(___) The problem you're having is that you...

6 years ago | 0

| accepted

Answered
Find different possible combinations of the rows of two matrices.
Fast & clean 2-liner: a = [1 2 3; 4 5 6; 7 8 10]; b = a + 10; c = [repmat(a,size(b,1),1), repelem(b, size(a,1),1)]; combos...

6 years ago | 0

Answered
Data representation with string header
If you have the Econometrics Toolbox you can use corrplot() to show a grid of correlations between all pairs of columns in your ...

6 years ago | 0

| accepted

Answered
How can I export the ANOVA results as a PNG?
> How can I export the ANOVA results as a PNG? If you're refering to the boxplot results, to save a figure as png, saveas(fig,f...

6 years ago | 0

Answered
Finding a matching pair of vectors between two matrix
Use [Lia,Locb] = ismember(A1,[XL;XR;XT;XB],'rows') Lia shows which rows of A1 are matches. find(Lia) shows the row numbers of t...

6 years ago | 1

Answered
How to know the date to which a group (findgroups) corresponds?
findgroups() Use the 2nd output [G,ID] = findgroups(A) G(i) belongs to ID(G(i),:). For example, A = ["D" "B" "B" "A" "D" "...

6 years ago | 0

| accepted

Answered
Change grid extent so title is visible
To vertically adjust the axis so the final title position is approximately where it would be from the top of the figure before r...

6 years ago | 0

Answered
How to detect the close window event for a "bar" graph
To invoke an action when the bars are deleted, use the DeleteFcn property of the bar object. Bars can be deleted using cla(), de...

6 years ago | 0

Answered
Is there any way that I Add a fourth row value to a find out 3x1 matrix?
mini_U(4,:) = 0

6 years ago | 0

| accepted

Answered
Is there any way to get a matrix from data set which contains x position, y position and magnitude?
Inputs are x, y, and m, which are your (x,y) coordinates and magnitudes, all the same length. Outputs are magMat and T. The ...

6 years ago | 0

| accepted

Load more