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

Solved

Increment a number, given its digits

Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

oltre 8 anni ago

Solved

Project Euler: Problem 1, Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

oltre 8 anni ago

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

Answered

How to connect points horizontally and vertically in non-rect grid?

Idea 1. Use SURF [x,y] = ndgrid(0:0.1:2); %Just making random data x = sin(x).*y; y = x+y.^2; figure, surf(x,y,z...

How to connect points horizontally and vertically in non-rect grid?

Idea 1. Use SURF [x,y] = ndgrid(0:0.1:2); %Just making random data x = sin(x).*y; y = x+y.^2; figure, surf(x,y,z...

circa 9 anni ago | 0

| accepted

Answered

Efficiently multiplying diagonal and general matrices

The best solution is going to depend on what your m and n actually are (if you know representative values of them, you should in...

Efficiently multiplying diagonal and general matrices

The best solution is going to depend on what your m and n actually are (if you know representative values of them, you should in...

circa 9 anni ago | 1

| accepted

Answered

Efficiently multiplying diagonal and general matrices

M = randn(10000,10); D = diag(randn(10000,1).^2); tic A = M'*D*M; toc tic B = bsxfun(@times,M,sqrt(dia...

Efficiently multiplying diagonal and general matrices

M = randn(10000,10); D = diag(randn(10000,1).^2); tic A = M'*D*M; toc tic B = bsxfun(@times,M,sqrt(dia...

circa 9 anni ago | 0

Answered

diagonal pixel differences of image matrix

b = [2 1 8 24;9 10 3 12;2 5 8 19;1 2 3 4]; conv2(b,[-1 0; 0 1],'valid')

diagonal pixel differences of image matrix

b = [2 1 8 24;9 10 3 12;2 5 8 19;1 2 3 4]; conv2(b,[-1 0; 0 1],'valid')

circa 9 anni ago | 1

Answered

ODE with diff? DE in x(t), w/ forcing y(t), where y'(t) also appears.

It might seem counterintuitive, but even though y'(t) appears in the ODE, you don't actually need to calculate it. No DIFF, no G...

ODE with diff? DE in x(t), w/ forcing y(t), where y'(t) also appears.

It might seem counterintuitive, but even though y'(t) appears in the ODE, you don't actually need to calculate it. No DIFF, no G...

circa 9 anni ago | 1

Answered

The advantages of MATLAB over other programing languges for Image Processing

I'm sure I've left a bunch of stuff off this list, but this is what I got off the top of my head. * A very large (and growing...

The advantages of MATLAB over other programing languges for Image Processing

I'm sure I've left a bunch of stuff off this list, but this is what I got off the top of my head. * A very large (and growing...

circa 9 anni ago | 2

Answered

minimum row value and return the row

Do you mean to say, you want the row with the minimum maximum value? A=[12 64 76; 34 10 27; 9 8 20; 10 30 8]; [value,ind...

minimum row value and return the row

Do you mean to say, you want the row with the minimum maximum value? A=[12 64 76; 34 10 27; 9 8 20; 10 30 8]; [value,ind...

circa 9 anni ago | 2

| accepted

Answered

Generate Y from the conditional f(y|x)

If your goal is to generate points with that 3-dimensional PDF, then I think it could be done a bit simpler without having to do...

Generate Y from the conditional f(y|x)

If your goal is to generate points with that 3-dimensional PDF, then I think it could be done a bit simpler without having to do...

circa 9 anni ago | 1

| accepted

Answered

Why isn't the autocorrelation of rand a delta function?

As described in detail here, <http://en.wikipedia.org/wiki/Autocorrelation>, there is more than one convention when calculating ...

Why isn't the autocorrelation of rand a delta function?

As described in detail here, <http://en.wikipedia.org/wiki/Autocorrelation>, there is more than one convention when calculating ...

circa 9 anni ago | 1

| accepted

Answered

Splitting an axis into a linear and log scale

I don't think there's an easy way to do it, but you might be able to piece together two axes to make it look like its half linea...

Splitting an axis into a linear and log scale

I don't think there's an easy way to do it, but you might be able to piece together two axes to make it look like its half linea...

circa 9 anni ago | 4

| accepted

Answered

Finding vertices of (large) linear program feasible region

For the k-th direction, the set of possible edge points is b./A(:,k) along with +/-Inf. So test each one in order to see if it i...

Finding vertices of (large) linear program feasible region

For the k-th direction, the set of possible edge points is b./A(:,k) along with +/-Inf. So test each one in order to see if it i...

circa 9 anni ago | 0

| accepted

Answered

Integral with scalar input

For an integrand that can't accept vector inputs, but only take scalar values one by one, you actually need to set ArrayValued t...

Integral with scalar input

For an integrand that can't accept vector inputs, but only take scalar values one by one, you actually need to set ArrayValued t...

circa 9 anni ago | 1

| accepted

Answered

In MATLAB (cumulative distribution function), how can I find the corresponding data point (Y) for any chosen cumulative probability?

Alternatively, you can use ICDF directly on the probability distribution object icdf(pd,[0.2 0.466])

In MATLAB (cumulative distribution function), how can I find the corresponding data point (Y) for any chosen cumulative probability?

Alternatively, you can use ICDF directly on the probability distribution object icdf(pd,[0.2 0.466])

circa 9 anni ago | 0

| accepted

Answered

Nesting parentheses issue: any workaround?

I am in agreement with Jan. I cannot recall a single instance where I needed to use 32 parenthesis for anything. If you really n...

Nesting parentheses issue: any workaround?

I am in agreement with Jan. I cannot recall a single instance where I needed to use 32 parenthesis for anything. If you really n...

circa 9 anni ago | 0

Answered

Fit a piece-wise linear function to data: fitting 2 lines to data and finding their corresponding parameters

You data doesn't really look like it has a constant trend at the beginning. In any case, you should still be able to solve it wi...

Fit a piece-wise linear function to data: fitting 2 lines to data and finding their corresponding parameters

You data doesn't really look like it has a constant trend at the beginning. In any case, you should still be able to solve it wi...

circa 9 anni ago | 0

| accepted

Answered

Find row in matrix, fast and with special conditions

Not sure if this is faster, but might be worth a try. d1 = 12650; d2 = 4; S = randn(d1,d2); s = S(randi(d1),:); ...

Find row in matrix, fast and with special conditions

Not sure if this is faster, but might be worth a try. d1 = 12650; d2 = 4; S = randn(d1,d2); s = S(randi(d1),:); ...

circa 9 anni ago | 0

Answered

How to calculate the cumulative value by consequetive hours

data = [1 2 3 4 5 6 7 8]; for n = 2:5 conv(data,ones(1,n),'valid') end This gives me: ans = 3 ...

How to calculate the cumulative value by consequetive hours

data = [1 2 3 4 5 6 7 8]; for n = 2:5 conv(data,ones(1,n),'valid') end This gives me: ans = 3 ...

circa 9 anni ago | 1