43.984 total contributions since 2011

I do not do free private consulting. If you want to bring my attention to something, send a link to the MATLAB Answers location.

Answered

Adding two arrays of different sizes together evenly without messing cumulative sum.

C = A + B / length(A);

Adding two arrays of different sizes together evenly without messing cumulative sum.

C = A + B / length(A);

etwa 2 Stunden ago | 0

Answered

Ask user for another image or abort

Delete the "clear all" -- you should never include "clear all" as part of a program that does computation. (But you could have a...

Ask user for another image or abort

Delete the "clear all" -- you should never include "clear all" as part of a program that does computation. (But you could have a...

etwa 3 Stunden ago | 0

Answered

Extracting the same column in a cell array for anova

col_to_extract = 1; the_columns_as_cells = cellfun(@(C) C(:,col_to_extract), YourCellArray, 'uniform', 0); You cannot, howev...

Extracting the same column in a cell array for anova

col_to_extract = 1; the_columns_as_cells = cellfun(@(C) C(:,col_to_extract), YourCellArray, 'uniform', 0); You cannot, howev...

etwa 3 Stunden ago | 0

Answered

Taylor Series Approximation of Sine

nn=720; nn is 720 angle=linspace(-2*pi,2*pi,nn) linspace(something, something, nn) creates a vector exactly nn in length, so ...

Taylor Series Approximation of Sine

nn=720; nn is 720 angle=linspace(-2*pi,2*pi,nn) linspace(something, something, nn) creates a vector exactly nn in length, so ...

etwa 3 Stunden ago | 0

| accepted

Answered

is table performance still the slowest in MALTAB R2019b?

Tables will always be slower than struct. I guarantee it.

is table performance still the slowest in MALTAB R2019b?

Tables will always be slower than struct. I guarantee it.

etwa 6 Stunden ago | 0

| accepted

Answered

How to know the real row and column indices of a pixel in the image

which_pixel = 37987; [r, c] = ind2sub([s(1), s(2)], which_pixel); And remember that row corresponds to Y and column correspo...

How to know the real row and column indices of a pixel in the image

which_pixel = 37987; [r, c] = ind2sub([s(1), s(2)], which_pixel); And remember that row corresponds to Y and column correspo...

etwa 20 Stunden ago | 0

Answered

Error using handle.handle/set Invalid or deleted object.

In your callback for edit1 you replace the handle with the value extracted from the handle. That is confusing at the very least....

Error using handle.handle/set Invalid or deleted object.

In your callback for edit1 you replace the handle with the value extracted from the handle. That is confusing at the very least....

ein Tag ago | 0

Answered

Regexp Find Digit between two hyphens

(?<=-)\d(?=-) Is one of the ways. (?-)\d(?-) might work

Regexp Find Digit between two hyphens

(?<=-)\d(?=-) Is one of the ways. (?-)\d(?-) might work

ein Tag ago | 0

| accepted

Answered

how to plot roots with a value used in the function?

for b = 0:10 p = [1 b -20]; r = roots(p); plot(b, r, 'k*'); hold on end hold off

how to plot roots with a value used in the function?

for b = 0:10 p = [1 b -20]; r = roots(p); plot(b, r, 'k*'); hold on end hold off

ein Tag ago | 0

| accepted

Answered

x domain for figure

I do not understand what your notation about (x covers this domain) means. However I can point out that 1:0.1:200 does not inclu...

x domain for figure

I do not understand what your notation about (x covers this domain) means. However I can point out that 1:0.1:200 does not inclu...

ein Tag ago | 0

Answered

signal processing buffer timeline

buffer() from the Signal Processing Toolbox can handle overlap. If you are asking about timeseries objects, then the answer is ...

signal processing buffer timeline

buffer() from the Signal Processing Toolbox can handle overlap. If you are asking about timeseries objects, then the answer is ...

ein Tag ago | 0

| accepted

Answered

How can I get the first row of different matrices into one matrix?

for iteration = 1 : 7 this_result = something \ something_else; combined_results(iteration,:) = this_result(1,:); end...

How can I get the first row of different matrices into one matrix?

for iteration = 1 : 7 this_result = something \ something_else; combined_results(iteration,:) = this_result(1,:); end...

ein Tag ago | 0

Answered

Principal component analysis pca

if j==NSamples You did not assign to j by that point in the code, so it has its default value of sqrt(-1) which does not equal ...

Principal component analysis pca

if j==NSamples You did not assign to j by that point in the code, so it has its default value of sqrt(-1) which does not equal ...

ein Tag ago | 0

Answered

How to copy and paste the code with matlab layout when asking question here?

Look in the toolbar at the section marked "CODE", and click on the icon that looks like a > symbol. That will give you a code en...

How to copy and paste the code with matlab layout when asking question here?

Look in the toolbar at the section marked "CODE", and click on the icon that looks like a > symbol. That will give you a code en...

2 Tage ago | 2

| accepted

Answered

How can i fix the error "Error using inline Input must be a character vector." and "Error in (line 9) g=inline(f);"

inline can only be used with character vectors. Your f is a double precision scalar. If you were to format it into a characte...

How can i fix the error "Error using inline Input must be a character vector." and "Error in (line 9) g=inline(f);"

inline can only be used with character vectors. Your f is a double precision scalar. If you were to format it into a characte...

3 Tage ago | 0

Answered

solving equation contains lambertw function

The Symbolic Toolbox has lambertw

solving equation contains lambertw function

The Symbolic Toolbox has lambertw

3 Tage ago | 0

Answered

How to clear file name and file path information?

Use '' or "" as the value instead of []

How to clear file name and file path information?

Use '' or "" as the value instead of []

4 Tage ago | 0

| accepted

Answered

why ismember({struct.name},{'*.mat'}) returns zero while struct.name='basevalues_Mean_r.mat'?

ismember() never does wildcarding. It only does exact matches. regexp() does matching but the handling of wildcards is differen...

why ismember({struct.name},{'*.mat'}) returns zero while struct.name='basevalues_Mean_r.mat'?

ismember() never does wildcarding. It only does exact matches. regexp() does matching but the handling of wildcards is differen...

4 Tage ago | 1

| accepted

Answered

How to find minimum number of largest square of 1 in an 2D bool matrix

D = bwdistgeodesic(logical(YourImage), ~YourImage); Now iterate. if there are no finite values in D, break the loop. Find the l...

How to find minimum number of largest square of 1 in an 2D bool matrix

D = bwdistgeodesic(logical(YourImage), ~YourImage); Now iterate. if there are no finite values in D, break the loop. Find the l...

4 Tage ago | 0

Answered

how can i convert 1xn to mxn matrix ?

Use persistent variables in your function. The first 19 times the function is called, just store the 100 values passed in. The 2...

how can i convert 1xn to mxn matrix ?

Use persistent variables in your function. The first 19 times the function is called, just store the 100 values passed in. The 2...

4 Tage ago | 0

Answered

Mat2Cell error when splitting an image up into smaller images

function blockImages = splitImageIntoBlocks(image, blockSizeRow, blockSizeCol) % blockSizeRow: Rows in block % blockSizeCol: C...

Mat2Cell error when splitting an image up into smaller images

function blockImages = splitImageIntoBlocks(image, blockSizeRow, blockSizeCol) % blockSizeRow: Rows in block % blockSizeCol: C...

4 Tage ago | 0

| accepted

Answered

How can I print each piece of data in the following colum while iterating through a for loop with fprintf

It is possible to build up tables one column at a time. In order to do so, you need to work with character arrays and sprintf, o...

How can I print each piece of data in the following colum while iterating through a for loop with fprintf

It is possible to build up tables one column at a time. In order to do so, you need to work with character arrays and sprintf, o...

4 Tage ago | 0

Answered

'trapz' to find area under curve not working

x=length(y) is a scalar value, just the length. You then pass that one length as the X coordinates and pass all of y as the Y co...

'trapz' to find area under curve not working

x=length(y) is a scalar value, just the length. You then pass that one length as the X coordinates and pass all of y as the Y co...

4 Tage ago | 0

| accepted

Answered

Getting rid of a for loop

value1 = find(input(1:end-2) > input(2:end-1) & input(2:end-1) < input(3:end)) + 1; value2 = input(value1);

Getting rid of a for loop

value1 = find(input(1:end-2) > input(2:end-1) & input(2:end-1) < input(3:end)) + 1; value2 = input(value1);

4 Tage ago | 1

| accepted

Answered

The crtrp function from the genetic-toolbox doesn't work

Line 34 can be deleted.

The crtrp function from the genetic-toolbox doesn't work

Line 34 can be deleted.

4 Tage ago | 0

Answered

difference between two programs

X=imread('mosque.jpg'); The great majority of .jpg are RGB (grayscale is possible but very rare.) [n,m]=size(X); size() of a...

difference between two programs

X=imread('mosque.jpg'); The great majority of .jpg are RGB (grayscale is possible but very rare.) [n,m]=size(X); size() of a...

4 Tage ago | 0

| accepted

Answered

X and Y must be same length, however they already are?

You do not store any x values, so it is [] after the reading loop.

X and Y must be same length, however they already are?

You do not store any x values, so it is [] after the reading loop.

4 Tage ago | 1

| accepted

Answered

Why does solve() parametrize the results in the conditions?

Your nonnegative and positive constraints together with the ^2 impose boundaries. The equation has to be solved in ways that the...

Why does solve() parametrize the results in the conditions?

Your nonnegative and positive constraints together with the ^2 impose boundaries. The equation has to be solved in ways that the...

5 Tage ago | 0

| accepted

Answered

How can I solve the error of {Undefined operator '.^' for input arguments of type 'optim.problemdef.OptimizationExpression'}?

You cannot fix that problem in that release. The first release or two of Problem Based Optimization supported only linear proble...

How can I solve the error of {Undefined operator '.^' for input arguments of type 'optim.problemdef.OptimizationExpression'}?

You cannot fix that problem in that release. The first release or two of Problem Based Optimization supported only linear proble...

5 Tage ago | 1

| accepted