Community Profile

# Matt J

##### Last seen: Today
7,000 total contributions since 2009

Professional Interests: medical image processing, optimization algorithms

View details...

Contributions in
View by

How to find the solutions to a set of linear equations?
You can easily trap the point where NaNs are introduced using >>dbstop if naninf https://www.mathworks.com/help/matlab/ref/dbs...

22 hours ago | 0

Efficient number occurence count
In this situation, accumarray will be faster than histcounts, but still not as fast as the for-loop, tic; hc=accumarray(num(:)...

1 day ago | 1

| accepted

Registation of two images in '.mat' format
With monomodal registration, it works fine for me, [optimizer, metric] = imregconfig('monomodal'); but I should mention that t...

1 day ago | 0

| accepted

construct a two level optimisation problem has fmincon solver for lower level and genetic algorithm for upper level
You are passing a variable called xl to LLConstraint(), but xl is not used anywhere within that function. The function is theref...

1 day ago | 0

Efficient number occurence count
I want to efficiently count the number of occurences of numbers between 1-numel(num) in a Matrix If that's really what you want...

2 days ago | 0

Using fsolve with multiple unknowns
...but unsure on the syntax for a problem like this. The syntax does not change. It is simply that your equation expressions w...

2 days ago | 0

Array value replace when change in row
A=randi([0,1],7,10); %Example [m,n]=size(A); [~,idx]=max(A,[],1); out = sparse(idx,1:n,1,m,n) ; A, full(out)

2 days ago | 0

| accepted

Create column vector with same length as a matrix(6x6).
Taking the question literally, one solution would be, (1:6).' but I feel there must be missing information.

2 days ago | 0

Name-Value Pairs error
If you use inputParser, you can define validation functions https://www.mathworks.com/help/matlab/ref/inputparser.html#d122e665...

2 days ago | 0

| accepted

How to solve non-linear integer problems (MINLP/INLP)
You will have to use ga() in the Global Optimization Toolbox.

2 days ago | 0

| accepted

How to code my own Reshape function without using the built in reshape()??
Hint: Notice the effect of doing things like this: A=nan(3,4); A(:)=1:12

3 days ago | 0

| accepted

Fit the Data to a Quadratic Function with a y-offset (y = b+mx^2) error
I get no error messages when I run your code. However, you do not need fit() to perform this fit. You can just use polyfit, p=p...

3 days ago | 1

| accepted

Fsolve cannot continue error

3 days ago | 0

unconstrained nonlinear optimization problem
Still, there are no constraints, so I think you should be using fminunc. Also, your revised objective function is not differenti...

3 days ago | 0

| accepted

Problems with a for loop
num2str(ck-1)

3 days ago | 0

Fill a nxm matrix with vectorised expression
No, there is no way to vectorize an element-wise function generically, without considering the specifics of the function. You ca...

3 days ago | 0

| accepted

I think you should just do, u = rand(sample_size,loop_times); number_of_success = sum(u<trueVal)

4 days ago | 0

Finding maximum of a function using optimization toolbox
Assuming you are solving a separate optimization for each i (see my comment above), it seems to me that the solution is very sim...

4 days ago | 0

Trying to Loop through different values of two matrixes simultaneously
You can form all combinations of two matrices using ndgrid, A=rand(3), B=rand(3) [AA,BB]=ndgrid(A,B)

4 days ago | 0

Create an array containing coordinate points
Usinge mat2tiles from the File Exchange, https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-divide-array-into...

4 days ago | 0

| accepted

I want to split a char array '1001' into 1 0 0 1 bits
One way: '1001' - '0'

4 days ago | 1

Optimizing "nested" variables with a genetic algorithm
The problem with this approach is that all entries of the matrix are scored as individuals. No, that shouldn't be. As long as ...

4 days ago | 0

| accepted

How to use lsqcurvefit to calculate Urban Heat Island Intensity

4 days ago | 0

What solver for an integer minimization problem with linear objective and fractional constraints?
You can use ga(), if you havet Global Optimization Toolbox.

4 days ago | 0

avoiding nested for loops for matrix assignment
x = 1:10000; a = x.' + x;

4 days ago | 0

how apply parfor for this code
No, parfor cannot be applied here. Your loop iterations are not parallel because lfPrev depends on previous iterations.

4 days ago | 0

Counting Whole Grains of Rice
Go through the list of pixel coordinates in each grain and check if any of them are border pixels. rice_grains=regionprops(bw1,...

5 days ago | 0

| accepted

Question

Is there a way to re-title the Matlab Editor window?
Sometimes, I have multiple Matlab instances open and within each of those, an undocked Matlab Editor window. It would be helpful...

5 days ago | 0 answers | 0