Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

1 year ago

Solved

Find the longest sequence of 1's in a binary sequence.

Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

1 year ago

Solved

Remove all the consonants

Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

1 year ago

Solved

Remove the vowels

Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

1 year ago

Solved

Regex match

Many regular expression engines have a simple function to quickly know whether a regular expression entirely matches a string or...

1 year ago

Answered

How can I use a legend for only only line in a subpot?

the legend is correct for what you plotted, each iteration creates 3 plots, the namesConditions has 4 entries, which are assigne...

How can I use a legend for only only line in a subpot?

the legend is correct for what you plotted, each iteration creates 3 plots, the namesConditions has 4 entries, which are assigne...

1 year ago | 0

Answered

How to remove cells that look seemingly like newline character from cell array?

You should determine which character you are seeing: Extract a cell that contains only the character in question and convert ...

How to remove cells that look seemingly like newline character from cell array?

You should determine which character you are seeing: Extract a cell that contains only the character in question and convert ...

1 year ago | 0

Answered

Assign XLabel, YLabel from variable, fix YLim

doc xlabel Edit: extented explanation: ax_handle.XLabel returns a handle for the label. This object has a property named "...

Assign XLabel, YLabel from variable, fix YLim

doc xlabel Edit: extented explanation: ax_handle.XLabel returns a handle for the label. This object has a property named "...

1 year ago | 0

Answered

How to write code the Chebyshev and Mahalanobis distance using bsxfun function?

Hi, your example code does not work. Bsxfun cannot operate on those arrays. When X (as in your case) is an Nx2 matrix, and y...

How to write code the Chebyshev and Mahalanobis distance using bsxfun function?

Hi, your example code does not work. Bsxfun cannot operate on those arrays. When X (as in your case) is an Nx2 matrix, and y...

2 years ago | 0

| accepted

Solved

Make the vector [1 2 3 4 5 6 7 8 9 10]

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

2 years ago

Answered

sprintf - Linux OK but Windows Warning: Escaped character '\.' is not valid. See 'doc sprintf' for supported special characters.

The warning you get should be: Escaped character '\%' is not valid. What you want is a platform dependent filesep ...

sprintf - Linux OK but Windows Warning: Escaped character '\.' is not valid. See 'doc sprintf' for supported special characters.

The warning you get should be: Escaped character '\%' is not valid. What you want is a platform dependent filesep ...

2 years ago | 0

Solved

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

2 years ago

Solved

Determine whether a vector is monotonically increasing

Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

2 years ago

Answered

Change a for loop iteration if condition is met

with a while loop: a=5; b=0; c=0; t = 1; while t <=100 a = a+t; if a == 20 b = 20; ...

Change a for loop iteration if condition is met

with a while loop: a=5; b=0; c=0; t = 1; while t <=100 a = a+t; if a == 20 b = 20; ...

2 years ago | 0

Answered

Drawing a white line on an image using (rho, theta).

My comment was the answer, so to stick to the structure of this forum: Your calculation of x and y yields to wrong values. If...

Drawing a white line on an image using (rho, theta).

My comment was the answer, so to stick to the structure of this forum: Your calculation of x and y yields to wrong values. If...

2 years ago | 0

Answered

vector thats sorts values , even or odd, using only function

I agree with Guillaume and Jan, you should explain a bit more of your problem. I'm not going to write the function, but here are...

vector thats sorts values , even or odd, using only function

I agree with Guillaume and Jan, you should explain a bit more of your problem. I'm not going to write the function, but here are...

2 years ago | 0

Answered

How to implement a (semi)automated algorithm for thorax and lung segmentation?

Have a look at <"https://de.mathworks.com/matlabcentral/answers/182511-model-reconstruction-from-ct-slices" this> and the mentio...

How to implement a (semi)automated algorithm for thorax and lung segmentation?

Have a look at <"https://de.mathworks.com/matlabcentral/answers/182511-model-reconstruction-from-ct-slices" this> and the mentio...

2 years ago | 0

Answered

How can read binary file one by one?

have a look at the <https://de.mathworks.com/help/matlab/ref/fread.html fread> function

How can read binary file one by one?

have a look at the <https://de.mathworks.com/help/matlab/ref/fread.html fread> function

2 years ago | 2

| accepted

Answered

Does relative velocity vector lie on the line?

define a vector between the two points and check if the cross product of the delta velocity and the connection vector is 0. so i...

Does relative velocity vector lie on the line?

define a vector between the two points and check if the cross product of the delta velocity and the connection vector is 0. so i...

2 years ago | 1

Answered

points too close XY space

assuming only neighboring points are of interest: % find close points, add first index because diff is one shorter than x ...

points too close XY space

assuming only neighboring points are of interest: % find close points, add first index because diff is one shorter than x ...

2 years ago | 0

Answered

How can I count the occurrences of each element in a vector in MATLAB?

here is another one: sum(bsxfun(@eq,x,x'),1) or if you want the output to be the same orientation as input sum(bsxf...

How can I count the occurrences of each element in a vector in MATLAB?

here is another one: sum(bsxfun(@eq,x,x'),1) or if you want the output to be the same orientation as input sum(bsxf...

2 years ago | 2

Answered

matlab 2016a figure window incorrect position and size

If the problem still exists, just add this line to the startup.m in your startup directory or your userpath. set(0,'default...

matlab 2016a figure window incorrect position and size

If the problem still exists, just add this line to the startup.m in your startup directory or your userpath. set(0,'default...

2 years ago | 1

| accepted

Answered

Convert matrix to vector of structs

simpler without any external functions olderpatients = structfun(@(X) X(data.age>80),data,'Uni',false);

Convert matrix to vector of structs

simpler without any external functions olderpatients = structfun(@(X) X(data.age>80),data,'Uni',false);

3 years ago | 1

Answered

How can I assign data from multiple spreadsheets to the same vector using one of the columns as the variable name?

I copied your example sheet to example.xlsx and tested the code below. Please Note the remarks, I would not recommend the use of...

How can I assign data from multiple spreadsheets to the same vector using one of the columns as the variable name?

I copied your example sheet to example.xlsx and tested the code below. Please Note the remarks, I would not recommend the use of...

3 years ago | 1

Answered

Why doesn't the quiver object property MaxHeadSize work?

Here's my findings... Testcode: function tst close all figure(3) clf; hold on for ii = 1:15 ...

Why doesn't the quiver object property MaxHeadSize work?

Here's my findings... Testcode: function tst close all figure(3) clf; hold on for ii = 1:15 ...

3 years ago | 0

Answered

Merging 10 scatter plots produced with different RNG sequences

you can access the data of each plot by X=cell(10,1) Y=X for ii = 1:10 f = open('figure_ii.fig') % use the cor...

Merging 10 scatter plots produced with different RNG sequences

you can access the data of each plot by X=cell(10,1) Y=X for ii = 1:10 f = open('figure_ii.fig') % use the cor...

3 years ago | 0

Answered

Are there any predefined discrete color set with optimal neighboring contrasts?

have a look at this: <http://www.mathworks.com/matlabcentral/fileexchange/29702-generate-maximally-perceptually-distinct-colors...

Are there any predefined discrete color set with optimal neighboring contrasts?

have a look at this: <http://www.mathworks.com/matlabcentral/fileexchange/29702-generate-maximally-perceptually-distinct-colors...

3 years ago | 0

Question

determine axes handle to which a legend belongs

Hi, pre 2014b I was able to use the following to get the axes handle to which a legend belongs figure; plot(sin(0:0.1...

3 years ago | 1 answer | 0