6 065 total contributions since 2009

Professional Interests: medical image processing, optimization algorithms

PLEASE NOTE: I do not read email sent through my author page. Please post questions about FEX submissions in their respective Comments section.

Answered

how to define a function inside a script so that I wont need to redefine local variables/tables to the function?

See Nested Functions.

how to define a function inside a script so that I wont need to redefine local variables/tables to the function?

See Nested Functions.

environ 14 heures ago | 0

Answered

finding all possible polynomial combinations of n variables

This should be better: n=30; combs=nchoosek(1:n,2); m=size(combs,1); S=sparse([1:m;1:m],combs.',1,m,n); exp_comb = [S;s...

finding all possible polynomial combinations of n variables

This should be better: n=30; combs=nchoosek(1:n,2); m=size(combs,1); S=sparse([1:m;1:m],combs.',1,m,n); exp_comb = [S;s...

environ 16 heures ago | 1

| accepted

Answered

finding all possible polynomial combinations of n variables

[vars{1:n}] = ndgrid(0:2); exp_comb = reshape(cat(n+1,vars{:}) ,[],n); exp_comb = exp_comb(sum(exp_comb,2)<=2 & sum(exp_c...

finding all possible polynomial combinations of n variables

[vars{1:n}] = ndgrid(0:2); exp_comb = reshape(cat(n+1,vars{:}) ,[],n); exp_comb = exp_comb(sum(exp_comb,2)<=2 & sum(exp_c...

environ 17 heures ago | 1

Answered

Coordinates of corners of quadrilateral in binary mask

The Computer Vision Toolbox has some ready-made corner detection functions, e.g., https://www.mathworks.com/help/vision/ref/det...

Coordinates of corners of quadrilateral in binary mask

The Computer Vision Toolbox has some ready-made corner detection functions, e.g., https://www.mathworks.com/help/vision/ref/det...

1 jour ago | 0

| accepted

Answered

Remove coordiantes with less than n repeats in y coordinate

G=findgroups(y); [C,~,idx]=histcounts(y, 1:max(G)+1); keep=C(idx)>=n; coords=coords(keep,:)

Remove coordiantes with less than n repeats in y coordinate

G=findgroups(y); [C,~,idx]=histcounts(y, 1:max(G)+1); keep=C(idx)>=n; coords=coords(keep,:)

1 jour ago | 0

| accepted

Answered

Implement average filter without using built-in functions

In all likelihood, you have not converted your image to floating point img = im2double( imread("Q3_Input", "tif") );

Implement average filter without using built-in functions

In all likelihood, you have not converted your image to floating point img = im2double( imread("Q3_Input", "tif") );

1 jour ago | 0

Answered

Linear Programming: Can you input fixed values to the output matrix ('x') before solving linprog for 'x'?

You can enforce this using upper and lower bounds ub(i)=lb(i)=knownvalue

Linear Programming: Can you input fixed values to the output matrix ('x') before solving linprog for 'x'?

You can enforce this using upper and lower bounds ub(i)=lb(i)=knownvalue

2 jours ago | 1

| accepted

Answered

Sum of matrix times scalars

Hold your 3x3 matrices in a 3x3xN array caled T and your scalars in an Nx1 vector called a and do, result=reshape(T,9,[])*a(:);...

Sum of matrix times scalars

Hold your 3x3 matrices in a 3x3xN array caled T and your scalars in an Nx1 vector called a and do, result=reshape(T,9,[])*a(:);...

2 jours ago | 1

| accepted

Answered

Please help me to using genetic algorithm

You can use prob2struct to obtain most of your problem parameters in solver form, problem=prob2struct(costprob); problem=rmf...

Please help me to using genetic algorithm

You can use prob2struct to obtain most of your problem parameters in solver form, problem=prob2struct(costprob); problem=rmf...

2 jours ago | 0

| accepted

Answered

How to Convert Euler Angles (Z-X-Z Convention) to Axis Angles for Image Stack Rotation

If angle2 is a rotation in y, I think you really meant rot2 = imrotate3(rot1,-angle2,[0 1 0],'crop'); % rot about y

How to Convert Euler Angles (Z-X-Z Convention) to Axis Angles for Image Stack Rotation

If angle2 is a rotation in y, I think you really meant rot2 = imrotate3(rot1,-angle2,[0 1 0],'crop'); % rot about y

2 jours ago | 0

Answered

How to Convert Euler Angles (Z-X-Z Convention) to Axis Angles for Image Stack Rotation

If you're going to use imrotate3 why not obtain rot3 in a single rotation of the dataset? [V,d]=eig(R,'vector'); [~,i]=min(ab...

How to Convert Euler Angles (Z-X-Z Convention) to Axis Angles for Image Stack Rotation

If you're going to use imrotate3 why not obtain rot3 in a single rotation of the dataset? [V,d]=eig(R,'vector'); [~,i]=min(ab...

2 jours ago | 0

Answered

Set parameterlimits while fitting with fminsearch

Here is a fairly popular version of fminsearch that lets you apply constraints https://www.mathworks.com/matlabcentral/fileexch...

Set parameterlimits while fitting with fminsearch

Here is a fairly popular version of fminsearch that lets you apply constraints https://www.mathworks.com/matlabcentral/fileexch...

2 jours ago | 0

Answered

Efficient way to assign single vectors to a cell array

for j = 1:length(monthName) filename = [directory, 'series', monthName{j}, '.mat']; S = load...

Efficient way to assign single vectors to a cell array

for j = 1:length(monthName) filename = [directory, 'series', monthName{j}, '.mat']; S = load...

3 jours ago | 0

| accepted

Answered

Slicing a matrix into multiple matrices

You can use mat2tiles https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-divide-array-into-equal-sized-sub-ar...

Slicing a matrix into multiple matrices

You can use mat2tiles https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-divide-array-into-equal-sized-sub-ar...

3 jours ago | 0

Answered

Fminsearch to minimize norm of rms vector and thus giving me an optimized A and B matrix

fun=@(X) RMSE(X,Test_C,Test_D,Test_U,Test_t,Test_SV, Surge_field, Heave_field, Pitch_Angle_field, Pitch_Rate_field) X_Min = f...

Fminsearch to minimize norm of rms vector and thus giving me an optimized A and B matrix

fun=@(X) RMSE(X,Test_C,Test_D,Test_U,Test_t,Test_SV, Surge_field, Heave_field, Pitch_Angle_field, Pitch_Rate_field) X_Min = f...

5 jours ago | 0

Answered

Applying a change of variables inside fmincon

You could add a regularizing penalty to better specify the solution p_i in the cases where it is ambiguous. Maybe an L1 penalty ...

Applying a change of variables inside fmincon

You could add a regularizing penalty to better specify the solution p_i in the cases where it is ambiguous. Maybe an L1 penalty ...

5 jours ago | 0

Answered

Applying a change of variables inside fmincon

If the dimension R^l is not too large, you could use vert2lcon https://www.mathworks.com/matlabcentral/fileexchange/30892-analy...

Applying a change of variables inside fmincon

If the dimension R^l is not too large, you could use vert2lcon https://www.mathworks.com/matlabcentral/fileexchange/30892-analy...

5 jours ago | 0

Answered

How to check if an entire column of string variables can potentially be converted to numerical values?

all(48<=yourMatrix(:) & yourMatrix(:)<=57)

How to check if an entire column of string variables can potentially be converted to numerical values?

all(48<=yourMatrix(:) & yourMatrix(:)<=57)

5 jours ago | 0

Answered

Calculating statistical functions for a structure array which each cell has a different size

A structure array doesn't have "cells" and doesn't look like that. I assume you really mean your data is a cell array, in which ...

Calculating statistical functions for a structure array which each cell has a different size

A structure array doesn't have "cells" and doesn't look like that. I assume you really mean your data is a cell array, in which ...

5 jours ago | 0

| accepted

Answered

For loop for summation

R= zeros(size(y)); N= -500:500; for j=1:numel(N) n=N(j); R = R + f(n).*y.^(-n); end

For loop for summation

R= zeros(size(y)); N= -500:500; for j=1:numel(N) n=N(j); R = R + f(n).*y.^(-n); end

6 jours ago | 1

| accepted

Answered

How to check if an entire column of string variables can potentially be converted to numerical values?

~any(isletter(yourMatrix(:)))

How to check if an entire column of string variables can potentially be converted to numerical values?

~any(isletter(yourMatrix(:)))

6 jours ago | 0

| accepted

Answered

Superimposing matrices in a specific location

Something like this, perhaps: [i0,j0]=deal(700,850); %target location [I,J,S]=find(smallMatrix); result = largeMatrix + ...

Superimposing matrices in a specific location

Something like this, perhaps: [i0,j0]=deal(700,850); %target location [I,J,S]=find(smallMatrix); result = largeMatrix + ...

6 jours ago | 0

| accepted

Answered

Trouble calculating column mean from a matrix - using different indices for each row

[m,n]=size(myMatrix); %Edited e=1:n; mask=VariableIndex1(:)<=e & e<=VariableIndex2(:); result=sum(myMatrix.*mask,2)./sum(...

Trouble calculating column mean from a matrix - using different indices for each row

[m,n]=size(myMatrix); %Edited e=1:n; mask=VariableIndex1(:)<=e & e<=VariableIndex2(:); result=sum(myMatrix.*mask,2)./sum(...

6 jours ago | 0

| accepted

Answered

Kron error when dealing with sparse gpuarrays

You may want to look at, https://www.mathworks.com/matlabcentral/fileexchange/25969-efficient-object-oriented-kronecker-product...

Kron error when dealing with sparse gpuarrays

You may want to look at, https://www.mathworks.com/matlabcentral/fileexchange/25969-efficient-object-oriented-kronecker-product...

6 jours ago | 0

Answered

Use several pools of workers in a parfor loop

Your terminology is a bit confusing. There is only ever 1 pool of workers, but each worker may use multiple cores and the entire...

Use several pools of workers in a parfor loop

Your terminology is a bit confusing. There is only ever 1 pool of workers, but each worker may use multiple cores and the entire...

7 jours ago | 0

Answered

How to write your own function for infinity-norm of a matrix

To sum the rows of any matrix A, sum(A,2)

How to write your own function for infinity-norm of a matrix

To sum the rows of any matrix A, sum(A,2)

7 jours ago | 0

Answered

Fastest way to substitute elements in a matrix at given positions?

idx = sub2ind([n,m], repmat((1:n).',1,l) ,B); A(idx)=value;

Fastest way to substitute elements in a matrix at given positions?

idx = sub2ind([n,m], repmat((1:n).',1,l) ,B); A(idx)=value;

8 jours ago | 0

| accepted

Answered

Matlab fmincon(function based) optimality issue :: constrained nonlinear optimization

But , in my case, optimality is very large even though the objective fval is converge (please check img.) Your plots are uninte...

Matlab fmincon(function based) optimality issue :: constrained nonlinear optimization

But , in my case, optimality is very large even though the objective fval is converge (please check img.) Your plots are uninte...

8 jours ago | 1

| accepted

Answered

How to use fzero in a loop to obtain the first 3 positve solutions for cos3x=sin3x?

It seems like a strange homework problem, since it is so easily solved analytically. Well, assuming we play dumb to that, you ne...

How to use fzero in a loop to obtain the first 3 positve solutions for cos3x=sin3x?

It seems like a strange homework problem, since it is so easily solved analytically. Well, assuming we play dumb to that, you ne...

8 jours ago | 0

Answered

gap filling with liner interpolation

A=xlsread('data.xlsx'); I=A==-9999; J=find(~I); B=A; B(I)=interp1(J,A(J),find(I));

gap filling with liner interpolation

A=xlsread('data.xlsx'); I=A==-9999; J=find(~I); B=A; B(I)=interp1(J,A(J),find(I));

8 jours ago | 0

| accepted