Community Profile

# Adam

Last seen: 4 days ago Active since 2013

Professional Interests: Signal Processing, OOP, Matlab GUI programming, Machine Learning

All

View badges

#### Content Feed

View by

Answered
How to not use a for loop
function I = intMidpointScalar(f, a, b, n) j = 0.5:n; h = (b-a)/n; x = a + j * h; I = sum( h * f(x) );...

3 months ago | 0

| accepted

Answered
Iteration is not stopping. Can you please help thanks.
Which iteration is not finishing? You have a nested for loop and two while loops in that code. I assume you mean one of the wh...

10 months ago | 0

Question

Change to code formatting behaviour in editor in R2021b?
Does anyone know if this is a change in default formatting behaviour for indents and formatting behaviour or whether I am just m...

1 year ago | 2 answers | 3

### 2

answers

Answered
Removing "head" entry from doubly linked list
Unless I am totally misunderstanding (possible given my initial confusion in my comment) your class works fine. What isn't fine...

1 year ago | 1

| accepted

Answered
how to find the count of unique values of a column in a array?
doc histcounts should give you the number of each of the elements in your array, so long as you parameterise it correctly if yo...

1 year ago | 0

| accepted

Answered
how to create a vector with known indices numbers
result = vector( positions ); will give you this, if what you mean is you want the numbers from those positions of vector rathe...

1 year ago | 0

| accepted

Answered
what does k = 0:25.5:255 function means
doc colon It means create an array starting at 0, incrementing by 25.5 each time, with a maximum value of 255. Easiest way to ...

1 year ago | 0

| accepted

Answered
Resize and sum a matrix
If you have the Image Processing Toolbox you can use blockproc something like the following: array2 = blockproc( array1, [n n],...

2 years ago | 2

| accepted

Answered
Whats the difference when using [ ] and : ?
key = [1 2 3 4 5 6 7 8 9 10]; res = reshape( key, 2, [] ); would give res = [ 1 3 5 7 9 2 4 6 8 10 ]; The [] indica...

2 years ago | 1

Answered
Get row and column of the closest value of a matrix from a variable
If you are using an up to date version of Matlab (scanning the release notes I think R2019a or later for the particular syntax o...

3 years ago | 0

Answered
How to round the decimal values?
ceil( 0.7954 * 1000 ) / 1000 It should also be noted though that many seemingly 'round' decimal numbers cannot be perfectly rep...

3 years ago | 0

Answered
Problem with loop index
Calculate the indices of all the rows you want to delete , then delete them all in one go afterwards, as e.g. rowsToDelete = [...

3 years ago | 1

Answered
Array indexing nth spaced element
a( 1:n:end )

3 years ago | 0

| accepted

Answered
How to remove outlier by 2.5 standard deviations from the mean?
Looking at the help in doc filloutliers this should work: filloutliers(A,'center','mean','ThresholdFactor', 2.5) replacing A...

3 years ago | 1

| accepted

Answered
How to make subplot accept the positions like matrix?
doc ind2sub This will convert linear indices to n-dimensional subscripts. e.g. [p(1), p(2)] = ind2sub( [3, 3], 2 );

3 years ago | 1

| accepted

Answered
input vector fra edit text in guide GUI
sscanf( str, '%d' ) or str2num( str ) would both work if the input is e.g. "1 2 3 4 5 6", although the first returns a column...

3 years ago | 1

| accepted

Answered
Defining a time varying function
if t < t0 result = a; else result = b; end gives what you want for this simple case, provided t0, a, b and t are al...

3 years ago | 0

Answered
i have different result
Just get rid of the loop and vectorise: ProbDG=1-(1./T); DGT=-log(-log(ProbDG)); It can be done in a loop, but it's the end o...

3 years ago | 0

| accepted

Answered
What are the options to use a script in app designer? and how to define it?
You don't have to, but you should want to as scripts are not suitable for going beyond just trying things out. Once you want to...

3 years ago | 0

| accepted

Answered
How to get handle to legend in a specific axes?
Legends are parented by the figure, not the axes, so you get a list of figure children like this: >> get( gcf, 'Children' ) an...

3 years ago | 0

| accepted

Answered
Combine two or more gaussian components into one Gaussian Mixture (gmdistribution)
Doesn't GC = gmdistribution( [muX; muY], cat( 3, SX, SY ), [1; 1] ); work?

3 years ago | 1

| accepted

Answered
divide 3d matrix (840,64,1536) by 1d matrix (1536,1)
A ./ reshape( B, [1 1 1536] );

3 years ago | 1

Answered
How do I extract the rows that have value 0 in one array from another new array?
newArray( ~thisArray, : ) where thisArray is the one you show here.

3 years ago | 1

| accepted

Answered
What type of data (200 x 200 x 200)
It's an array. A 3d array to be precise, but just an array. A vector (as defined by isvector(...) )is an nx1 or 1xn array A m...

3 years ago | 1

| accepted

Answered
" bsxfun(@rdivide..." Explain Use in Code
rgbh_e = bsxfun(@rdivide, rgbh_e, rgbh_e(4,:)); divides rgbh_e by by the 4th row of rgbh_e, on a per row basis - i.e. each elem...

3 years ago | 0

Answered
In which Matlab version was rng() introduced?
https://uk.mathworks.com/help/matlab/release-notes.html?rntext=rng&startrelease=R2006a&endrelease=R2019b&groupby=release&sortby=...

3 years ago | 1

| accepted

Answered
what is wrong with my script?
2:4 means [2, 3, 4] A( [2 4], [2 4] ) would give what you want.

3 years ago | 1

| accepted

Answered
Arguments block syntax not being recognised
This was only introduced in 2019b (you can see at the bottom of the help page for 'arguments'). It is one of the disadvantages ...

3 years ago | 1

| accepted

Answered
Matrix creation combining vectors
M = [ repmat( V1(:), [numel(V2), 1] ), repelem( V2(:), numel( V1 ) ) ];

3 years ago | 0

| accepted

Answered
Help with restricting input
validateattributes( number, { 'numeric' }, { 'scalar', '>=', 1, '<=', 100, 'integer' } ) You would have to put a message togeth...

3 years ago | 0