Answered
Eliminate repetition in rows addition
You can replace those loops with this: A = [3 10; 5 6; 7 8]; triu(sum(A,2)+sum(A,2)',1) ans = 0 24 28 0 ...

7 years ago | 1

| accepted

Answered
How to clear graphical objects
Prior to drawing the updated ployshape, clear the axes using cla() and always specify the axis handle. cla(axHandle); ploysh...

7 years ago | 1

| accepted

Answered
Timetable linear interpolation within a range
This solution has 3 steps: determine which rows are within 10 or more consecutive rows of missing data interpolate all missi...

7 years ago | 1

| accepted

Answered
How to find a column with a specific set of numbers
Use ismember() with 'rows' option. % m is your matrix colIdx = ismember(m.', [6 0 0], 'rows')'; % note the transpose of m ...

7 years ago | 0

Answered
Is Walter Roberson a real person, or is he some kind of Matlab AI robot?
There are small windows of silence from WR that follow a circadian cycle suggesting periods of sleep which would be evidence tha...

7 years ago | 11

Answered
How can I create a Figure Title with a variable in it?
DEPTH = 10; % Depth changes based on user input title(sprintf('Numbers at a depth of %.0f meters', DEPTH)) % For the figure ...

7 years ago | 3

Answered
Compare 2 time series, array and map to third.
This should work for you. The last value of B is changed to -inf so that all values other than NaN will be greater than or equa...

7 years ago | 0

| accepted

Answered
is there a way to obtain peak width after peak detection ?
Use the "halfheight" width reference. There's an example here: https://www.mathworks.com/help/signal/ref/findpeaks.html#buhd6x...

7 years ago | 0

Answered
what causes "Z must be a matrix, not a scalar or vector" in mesh()
From the documentation for mesh() (<-- the first place you should go to understand the inputs to a function): " If X and Y are...

7 years ago | 1

| accepted

Answered
remove the blank area surrounding the figure
"How can I I remove the blank area surrounding the figure, which means to enable the figure to fill the whole window" If you'...

7 years ago | 0

| accepted

Answered
Using imagesc to make a matrix a heatmap, how can I mark an 'x' inside the cell of max value of each column?
Here's a simpler version that uses an "X" in text format. Just replace my fake "C" with your real data. C = magic(9); I = i...

7 years ago | 0

| accepted

Answered
how to solve equation for a given matrix
What's wrong with what you've already got? %Vector method e = rand(100,1)*10; Eq = 0.4075*exp(-((e-14.87)/11.39).^2) + 0.56...

7 years ago | 0

| accepted

Answered
Matlab: use axes handles of another figure for a new figure
If you're trying to create several figures with the same format but different data, you'd want to copy the entire figure, and th...

7 years ago | 1

| accepted

Answered
How to read specific data from a text file
You should be able to pull both numbers out at the same time with this: LaLoTokens = regexp(text1,'Station +(\d*\.?\d+) +N +(\d...

7 years ago | 1

| accepted

Answered
Test Results in a table
This should get you started. This solution only saves the h and pValue outputs - you can add in the stat and cValue variables b...

7 years ago | 0

| accepted

Answered
NAN answers problem in matrix
First, two take-home messages 0/0 = nan Once you have a NaN in your data, it potentially spreads like wildfire The NaN is fir...

7 years ago | 0

| accepted

Answered
use color bar as item in App-designer drop down list
I don't think that's possible in app designer. Here's are two alternatives that will require a little work but they're doable. ...

7 years ago | 0

Answered
How to make two plots happen at the same time on two different axes?
Here's a demo to follow. It creates two axes that display the time course of a sine and cosine wave. Run it, step through it t...

7 years ago | 1

Answered
Extracting a matrix by row and column from a large matrix
I changed your example matrix a bit to make sure it ignores partial pattern matches. m = [1 1 1 2000 1 1 1 2000 ...

7 years ago | 0

| accepted

Answered
How to find position of a number in an array using a drop down
Here's how to create a quick UI dropdown list populated with values from column 1 of your matrix. After the user makes a select...

7 years ago | 0

| accepted

Answered
Vector inside another vector
S =(0:30)'; k = 15; U = S .* (S>=k);

7 years ago | 0

| accepted

Answered
How to save AUTOMATICALLY all opened figures (unknown amount) in one .pdf file.
Get handles to all open figures: figHandles = findall(0,'Type','figure'); Then use export_fig() to save them to a PDF using ...

7 years ago | 3

| accepted

Answered
Follow up: How can I merge two different tables using the first column in common?
I find it easier to first combine the matrices into a 3D array. This should work with any number of matrices as long as they are...

7 years ago | 0

Answered
Normalize Matrix to 512?
I know next to nothing about .sift files but if you search for "512" in this link, you'll find the same instructions you shared ...

7 years ago | 1

| accepted

Answered
How to dynamically name each box on a boxplot?
You can convert the nested field names into a string using this FEX submission: fieldnamesr() Then you can use those strings as...

7 years ago | 0

| accepted

Answered
Why do these two different way to find slope give different results?
The basic fitting tool merely calls polyfit() using your x and y values (see link for more info). You can get the same coeffi...

7 years ago | 1

| accepted

Answered
Any possibilities of using sortrows for strings
If I'm understanding correclty, no need for sortrows(). b = {'hello';'world';'hello world';'world hello'}; a = [3 1 4 2]; R...

7 years ago | 0

| accepted

Answered
how can fill a table using a loop ?
No-loop method There's no need for a loop. b = cumsum(a)./(1:length(a)); Loop method If you must use a loop... b = zeros(...

7 years ago | 1

| accepted

Answered
How can I estimate the average for each one of the intervals in an x axis?
This is relatively straight forward with histcounts() and splitapply(). % Create fake data x = randi(1000,1,1000); %doesn'...

7 years ago | 1

| accepted

Answered
A basic question of matrix indexing can't get a proper output
Here are some improvements to your code so that it works no matter what size A is. A = [1:5; 6:10; 11:15; 16:20]; v= A(:,2...

7 years ago | 2

| accepted

Load more