Answered

Using an index in a loop as a variable in another function

You need to provide it as an additional argument (the same holds for d, g, and h): ... alpha(n+1,j) = alpha(n,j) + h * vel...

Using an index in a loop as a variable in another function

You need to provide it as an additional argument (the same holds for d, g, and h): ... alpha(n+1,j) = alpha(n,j) + h * vel...

ungefär 2 månader ago | 0

| accepted

Answered

Array indices must be positive integers or logical values.

The first entry in any kind of Matlab vector/array/matrix... is indexed with 1 (and not 0, as for example in C++). That is why y...

Array indices must be positive integers or logical values.

The first entry in any kind of Matlab vector/array/matrix... is indexed with 1 (and not 0, as for example in C++). That is why y...

3 månader ago | 0

Answered

Save elements of an array in a byte variable.

% random array of 8 rows with 4 bytes each bin = logical(round(rand(8, 32))); % how many bytes are there in total NoBytes =...

Save elements of an array in a byte variable.

% random array of 8 rows with 4 bytes each bin = logical(round(rand(8, 32))); % how many bytes are there in total NoBytes =...

4 månader ago | 1

| accepted

Answered

Selecting specific values from an array based on a defined condition

Th logical expression 0 <= m+d <= 300 is not interpreted by Matlab as you think it is. It rather is interpreted as (0 <= m+d...

Selecting specific values from an array based on a defined condition

Th logical expression 0 <= m+d <= 300 is not interpreted by Matlab as you think it is. It rather is interpreted as (0 <= m+d...

4 månader ago | 1

Answered

How to express coordinate range of an area

You are looking for the colon operator (https://www.mathworks.com/help/matlab/ref/colon.html) x = 1119:1121; y = 392:394;

How to express coordinate range of an area

You are looking for the colon operator (https://www.mathworks.com/help/matlab/ref/colon.html) x = 1119:1121; y = 392:394;

4 månader ago | 0

Answered

How to make the binarized image clearer

The problem why your output looks like this is not necessarily to do with the imbinarize function. The problem lies in the way t...

How to make the binarized image clearer

The problem why your output looks like this is not necessarily to do with the imbinarize function. The problem lies in the way t...

4 månader ago | 0

Answered

Returning negetive numbesr from text file using regexp

With questions like these it's very helpful to have an example of waht exactly your data looks like. If you know exactly how you...

Returning negetive numbesr from text file using regexp

With questions like these it's very helpful to have an example of waht exactly your data looks like. If you know exactly how you...

4 månader ago | 0

| accepted

Solved

Vector creation

Create a vector using square brackets going from 1 to the given value x in steps on 1. Hint: use increment.

4 månader ago

Solved

Doubling elements in a vector

Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

4 månader ago

Answered

Swapping the columns based on matrix even length

Assuming that there is always an even number of columns: matrix = repmat(1:10, [3, 1]); L = size(matrix, 2); ind = [2:2:L...

Swapping the columns based on matrix even length

Assuming that there is always an even number of columns: matrix = repmat(1:10, [3, 1]); L = size(matrix, 2); ind = [2:2:L...

4 månader ago | 0

| accepted

Answered

How to fuse SPECT and CT images having different matrix sizes?

You can import the data using dicomreadVolume (https://www.mathworks.com/help/images/ref/dicomreadvolume.html) There is an intr...

How to fuse SPECT and CT images having different matrix sizes?

You can import the data using dicomreadVolume (https://www.mathworks.com/help/images/ref/dicomreadvolume.html) There is an intr...

4 månader ago | 1

Answered

How can I fit a Gaussian to data that only forms the peak

You should always help your fitting algorithm by setting upper and lower bounds for the parameters. Even more important are star...

How can I fit a Gaussian to data that only forms the peak

You should always help your fitting algorithm by setting upper and lower bounds for the parameters. Even more important are star...

4 månader ago | 0

| accepted

Answered

ranking of vector with non-unique elements

So you want to order starting with the highest value? F = [10.1 31.0 20.5 20.5 10.1] [~, ~, rankF] = unique(max(F)-F)

ranking of vector with non-unique elements

So you want to order starting with the highest value? F = [10.1 31.0 20.5 20.5 10.1] [~, ~, rankF] = unique(max(F)-F)

4 månader ago | 3

| accepted

Answered

Standard Deviation of 3D matrix with NaN elements

As described in the doumentation for std, there is a flag on how to deal with 'NaN' values. If you want the standard deviation o...

Standard Deviation of 3D matrix with NaN elements

As described in the doumentation for std, there is a flag on how to deal with 'NaN' values. If you want the standard deviation o...

4 månader ago | 1

Answered

How to make two numeric field related in GUI?

The 'Callback' property of the uicontrol defines which function to call when you press enter while the edit field is in focus. A...

How to make two numeric field related in GUI?

The 'Callback' property of the uicontrol defines which function to call when you press enter while the edit field is in focus. A...

4 månader ago | 0

Answered

How to randomize audio files

What kind of randomization do you want? Play all sounds once, before playing a sound twice? randomizedOrder = randperm(80); ...

How to randomize audio files

What kind of randomization do you want? Play all sounds once, before playing a sound twice? randomizedOrder = randperm(80); ...

5 månader ago | 0

Answered

How to reshape a square matrix diagonally to a vector?

I would start with writing down the subscripts in the order you want to select the elements of the matrix. A=[0 1 0; 1 1 1...

How to reshape a square matrix diagonally to a vector?

I would start with writing down the subscripts in the order you want to select the elements of the matrix. A=[0 1 0; 1 1 1...

5 månader ago | 1

Answered

How to assign a different name of a matrix for each iteration?

You could use assignin for that purpose: for j = 1 : size(varargout,2) fn = modalfit(varargout{1,j}, f, fs, 10, 'FreqRange', ...

How to assign a different name of a matrix for each iteration?

You could use assignin for that purpose: for j = 1 : size(varargout,2) fn = modalfit(varargout{1,j}, f, fs, 10, 'FreqRange', ...

5 månader ago | 0

Answered

for loop values of certain output range

Two possible solutions: x = 3; idx = 1; for c = -2:1:2; for q = -2:1:2; g = (c*x)+q*(c+x); % g at this...

for loop values of certain output range

Two possible solutions: x = 3; idx = 1; for c = -2:1:2; for q = -2:1:2; g = (c*x)+q*(c+x); % g at this...

5 månader ago | 0

| accepted

Solved

Alternating sum

Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...

5 månader ago

Answered

How to save the image WITHOUT the white background using imwrite (advanced problem)

% read image as NxMx3 rgb matrix RGB = imread('bird1.png'); imshow(RGB) s = size(RGB); rectangle('position',[1 1 s(2) s(1)...

How to save the image WITHOUT the white background using imwrite (advanced problem)

% read image as NxMx3 rgb matrix RGB = imread('bird1.png'); imshow(RGB) s = size(RGB); rectangle('position',[1 1 s(2) s(1)...

5 månader ago | 0

Answered

How do I check if a folder exists which has a variable name?

Your code is trying to store in fname the content of the field 'bin' of the struct 'Measurement_20190829_18_15_10', which propab...

How do I check if a folder exists which has a variable name?

Your code is trying to store in fname the content of the field 'bin' of the struct 'Measurement_20190829_18_15_10', which propab...

5 månader ago | 0

Answered

How to find the previous position in an array where a value is met?

This is an ideal playgrouond to see how you can increase speed by avoiding for loops. % My idea is to create an array, that in ...

How to find the previous position in an array where a value is met?

This is an ideal playgrouond to see how you can increase speed by avoiding for loops. % My idea is to create an array, that in ...

5 månader ago | 2

| accepted

Answered

Project data for each pixel along the edge direction

Do you know the angle? You could rotate the image to align the edge with the grid and then project along one dimension: %% exam...

Project data for each pixel along the edge direction

Do you know the angle? You could rotate the image to align the edge with the grid and then project along one dimension: %% exam...

5 månader ago | 0

Solved

Bullseye Matrix

Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

5 månader ago

Solved

Return the largest number that is adjacent to a zero

This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

5 månader ago

Solved

Sort a list of complex numbers based on far they are from the origin.

Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

5 månader ago