Answered

How to create a loop to sum across columns conditional on index matching?

result = [unique(A(:,1)) grpstats(A(:,2:end),A(:,1),@any)] % Keep it binary or result = [unique(A(:,1)) grpstats(A(:,2...

How to create a loop to sum across columns conditional on index matching?

result = [unique(A(:,1)) grpstats(A(:,2:end),A(:,1),@any)] % Keep it binary or result = [unique(A(:,1)) grpstats(A(:,2...

circa 6 anni ago | 1

Answered

グレースケールの3次元マッピング

たとえば： I_RGB = imread('peppers.png'); I_gray = rgb2gray(I_RGB); h = surf(I_gray); % surf関数で表面を作成する h.EdgeColor = 'n...

グレースケールの3次元マッピング

たとえば： I_RGB = imread('peppers.png'); I_gray = rgb2gray(I_RGB); h = surf(I_gray); % surf関数で表面を作成する h.EdgeColor = 'n...

circa 6 anni ago | 4

| accepted

Answered

Getting NaN values in neural network weight matrices

As of R2016b, you could use the <https://www.mathworks.com/help/matlab/ref/rmmissing.html RMMISSING> function. Heave_datase...

Getting NaN values in neural network weight matrices

As of R2016b, you could use the <https://www.mathworks.com/help/matlab/ref/rmmissing.html RMMISSING> function. Heave_datase...

circa 6 anni ago | 1

Answered

Vectorisation of a simple for loop

Just wondering, but what is your purpose in vectorizing that code? If it's to make it faster, I don't think you can do much bett...

Vectorisation of a simple for loop

Just wondering, but what is your purpose in vectorizing that code? If it's to make it faster, I don't think you can do much bett...

circa 6 anni ago | 3

Answered

複数のテキストデータから一つの散布図の作り方

2番目以降のscatterplotに、最初に作成されたscatterplotのfigureハンドルを与えれば、figureが再利用できます。 たとえば： h = scatterplot(randn(100,2)); hold on; ...

複数のテキストデータから一つの散布図の作り方

2番目以降のscatterplotに、最初に作成されたscatterplotのfigureハンドルを与えれば、figureが再利用できます。 たとえば： h = scatterplot(randn(100,2)); hold on; ...

circa 6 anni ago | 0

| accepted

Answered

I have a vector like x=[2 3 1 5],how could I generate a vector like [1 2 1 2 3 1 1 2 3 4 5]?

x = [2 3 1 5] y = arrayfun(@(a)1:a,x,'uniform',0) y = cat(2,y{:}) y = 1 2 1 2 3 1 1 ...

I have a vector like x=[2 3 1 5],how could I generate a vector like [1 2 1 2 3 1 1 2 3 4 5]?

x = [2 3 1 5] y = arrayfun(@(a)1:a,x,'uniform',0) y = cat(2,y{:}) y = 1 2 1 2 3 1 1 ...

circa 6 anni ago | 1

Answered

How to find number of neigbours of a pixel in binary image?

Here are two ways to do it: numberNeighboringPixels = 2; % Can also be 1 or 3 BW1 = rand(15,60) > 0.9; % Just a ...

How to find number of neigbours of a pixel in binary image?

Here are two ways to do it: numberNeighboringPixels = 2; % Can also be 1 or 3 BW1 = rand(15,60) > 0.9; % Just a ...

circa 6 anni ago | 2

| accepted

Answered

Replace NaN values with values based on same group and other group?

I think this should work. % Sample data T = cell2table({'ID1' 100 'aaa'; 'ID1' nan 'bbb'; ...

Replace NaN values with values based on same group and other group?

I think this should work. % Sample data T = cell2table({'ID1' 100 'aaa'; 'ID1' nan 'bbb'; ...

circa 6 anni ago | 0

| accepted

Answered

Surf respresentation of a transfer function depending on the frequency and the gain of the feedback

You can loop over different values of "gain" and collect the results in a matrix and then plot it as a surface. rng(0) s...

Surf respresentation of a transfer function depending on the frequency and the gain of the feedback

You can loop over different values of "gain" and collect the results in a matrix and then plot it as a surface. rng(0) s...

circa 6 anni ago | 0

Answered

hour to hour minute second conversion

There's a <http://www.mathworks.com/help/matlab/date-and-time-operations.html lot of really good new functionality for working w...

hour to hour minute second conversion

There's a <http://www.mathworks.com/help/matlab/date-and-time-operations.html lot of really good new functionality for working w...

circa 6 anni ago | 1

Answered

I need some help,(i.e) my image is 192x192, i need to divide it into 3x3,and from each 3x3 block,by taking center pixel value as threshold, i need to compare with other neighbouring 8 pixel values, if that value is less than threshld, put 0, else 1

If you have the Image Processing Toolbox, you can use <http://www.mathworks.com/help/images/ref/blockproc.html BLOCKPROC> , whic...

I need some help,(i.e) my image is 192x192, i need to divide it into 3x3,and from each 3x3 block,by taking center pixel value as threshold, i need to compare with other neighbouring 8 pixel values, if that value is less than threshld, put 0, else 1

If you have the Image Processing Toolbox, you can use <http://www.mathworks.com/help/images/ref/blockproc.html BLOCKPROC> , whic...

circa 6 anni ago | 0

Answered

Intersection of two sfit planes?

This works for me: %% 1. Making some test coefficients c1=1; c2=2; c3=3; c4=4; c5=5; p1=-1.1; p2=2.2; p3=-3.3; p4=...

Intersection of two sfit planes?

This works for me: %% 1. Making some test coefficients c1=1; c2=2; c3=3; c4=4; c5=5; p1=-1.1; p2=2.2; p3=-3.3; p4=...

circa 6 anni ago | 0

Answered

Matrix version of quadprog?

You can convert this into a form usable by QUADPROG by noting the identity: tr(X'*H*X) == vec(X)' * kron(I, H) * vec(X) wh...

Matrix version of quadprog?

You can convert this into a form usable by QUADPROG by noting the identity: tr(X'*H*X) == vec(X)' * kron(I, H) * vec(X) wh...

circa 6 anni ago | 0

| accepted

Answered

non linear minimization problem

It depends on what you mean by "minimize". Do you mean the sum of squares, sum(E.^2)? If so then it's a quadratic programming...

non linear minimization problem

It depends on what you mean by "minimize". Do you mean the sum of squares, sum(E.^2)? If so then it's a quadratic programming...

oltre 6 anni ago | 1

| accepted

Answered

How to perform quadratic optimization

Here is how you might solve it using QUADPROG. Note that you don't need to do anything symbolic using "sym". L = length(ESF...

How to perform quadratic optimization

Here is how you might solve it using QUADPROG. Note that you don't need to do anything symbolic using "sym". L = length(ESF...

oltre 6 anni ago | 2

Answered

Slow Find Loop no vectorisation

FOR loops are *not* necessarily slow. This is in R2016a. %% Make some data... rng(0); image = randi(2^16,[30 40 50]...

Slow Find Loop no vectorisation

FOR loops are *not* necessarily slow. This is in R2016a. %% Make some data... rng(0); image = randi(2^16,[30 40 50]...

oltre 6 anni ago | 1

Answered

Finding surface height at x,y coordinates

Instead of GRIDDATA, I think "scatteredInterpolant" is what you want. This creates an object that you can use to query points fr...

Finding surface height at x,y coordinates

Instead of GRIDDATA, I think "scatteredInterpolant" is what you want. This creates an object that you can use to query points fr...

oltre 6 anni ago | 3

| accepted

Answered

how to determine similar values in 2 equally-sized matrices (for non-zero elements which are in similar positions) ?

A = [ 1 2 4; 5 0 6]; B = [0 2 5; 2 0 6]; Final_output = (A==B) & (A ~= 0) This gives Fi...

how to determine similar values in 2 equally-sized matrices (for non-zero elements which are in similar positions) ?

A = [ 1 2 4; 5 0 6]; B = [0 2 5; 2 0 6]; Final_output = (A==B) & (A ~= 0) This gives Fi...

oltre 6 anni ago | 0

| accepted

Answered

Need help with cylinders

% Make a figure (I like my figures in black) colordef(figure,'black'); % Draw a parameterized surface [TH...

Need help with cylinders

% Make a figure (I like my figures in black) colordef(figure,'black'); % Draw a parameterized surface [TH...

oltre 6 anni ago | 1

Answered

How do I read in a binary file that has a very unique data structure?

Would it be possible to use FREAD with the precision specified? For example: %% Just making some test data... (16bit,12bit...

How do I read in a binary file that has a very unique data structure?

Would it be possible to use FREAD with the precision specified? For example: %% Just making some test data... (16bit,12bit...

oltre 6 anni ago | 0

Answered

How to remove duplicate nodes from generated path and segments inbetween?

If you have R2015b or newer, there are built-in functions to do this. In particular, <http://www.mathworks.com/help/matlab/ref/g...

How to remove duplicate nodes from generated path and segments inbetween?

If you have R2015b or newer, there are built-in functions to do this. In particular, <http://www.mathworks.com/help/matlab/ref/g...

oltre 6 anni ago | 0

Answered

Modified Outerjoin function code

This requires a bit more creativity, but this is how I would do it. %% 1. Making the data (see my comment at the end) A ...

Modified Outerjoin function code

This requires a bit more creativity, but this is how I would do it. %% 1. Making the data (see my comment at the end) A ...

oltre 6 anni ago | 0

Answered

Modified version of VLOOKUP for Matlab

You can do this using <http://www.mathworks.com/help/matlab/ref/outerjoin.html OUTERJOIN> . A = table; A.ID = [1;1;2]; ...

Modified version of VLOOKUP for Matlab

You can do this using <http://www.mathworks.com/help/matlab/ref/outerjoin.html OUTERJOIN> . A = table; A.ID = [1;1;2]; ...

oltre 6 anni ago | 1

| accepted

Answered

NSP (Nurse Scheduling Problem)

This blog post may be of help: <http://blogs.mathworks.com/loren/2016/01/06/generating-an-optimal-employee-work-schedule-usin...

NSP (Nurse Scheduling Problem)

This blog post may be of help: <http://blogs.mathworks.com/loren/2016/01/06/generating-an-optimal-employee-work-schedule-usin...

oltre 6 anni ago | 2

Answered

how can I find the minimum distance from convex boundary

I like Matt J's SVM-based idea. It is actually very straightforward to solve this as a maximum separation problem. Reference:...

how can I find the minimum distance from convex boundary

I like Matt J's SVM-based idea. It is actually very straightforward to solve this as a maximum separation problem. Reference:...

oltre 8 anni ago | 2

Answered

How to constantly update a plot off of a slider being pulled

I know what you are trying to do, I often want to do the same Save the following in a file and run it to see an example: ...

How to constantly update a plot off of a slider being pulled

I know what you are trying to do, I often want to do the same Save the following in a file and run it to see an example: ...

oltre 8 anni ago | 1

| accepted

Answered

Is there a way to speed up matrix calculations by Parallel Computing Toolbox?

As others have pointed out, this will be difficult to parallelize for a single run, since you are integrating forward in time, a...

Is there a way to speed up matrix calculations by Parallel Computing Toolbox?

As others have pointed out, this will be difficult to parallelize for a single run, since you are integrating forward in time, a...

circa 9 anni ago | 0

| accepted

Answered

Find all largest empty circles in a list of points

You don't have to try all combinations. You just need to calculate the Delaunay triangulation. Assuming that no 4 points lie on ...

Find all largest empty circles in a list of points

You don't have to try all combinations. You just need to calculate the Delaunay triangulation. Assuming that no 4 points lie on ...

circa 9 anni ago | 2

Answered

Matlab executable requires 8.1 of MCR

You could also download it yourself here: <http://www.mathworks.com/products/compiler/mcr/index.html> Version 8.1 correspo...

Matlab executable requires 8.1 of MCR

You could also download it yourself here: <http://www.mathworks.com/products/compiler/mcr/index.html> Version 8.1 correspo...

circa 9 anni ago | 3

| accepted

Answered

Remove the spurious edge of skeleton

I think there must be a more efficient way to do it, but this at least works. BWDISTGEODESIC starts at a given point, and then c...

Remove the spurious edge of skeleton

I think there must be a more efficient way to do it, but this at least works. BWDISTGEODESIC starts at a given point, and then c...

circa 9 anni ago | 11

| accepted