Answered
How do I turn of thr grid of a surface but keep the edge line on?
Just serve yourself with plot3 commands [X,Y,Z] = peaks; surf(X,Y,Z,'edgecolor','none'); hold on plot3(X(1,:),Y(1,:),Z(1,:),...

6 years ago | 1

Answered
Select points inside a polygon
Here is the code using POLYSHAPE load('Points.mat') load('polygon1_x.mat') load('polygon1_y.mat') lat = Points.lat; ...

6 years ago | 3

| accepted

Answered
Select points inside a polygon
But you already have the index in your code. here ... inon = in | on; % Combine .i...

6 years ago | 1

Answered
How to make a matrix of zeros and ones with a specific distance between each one?
dmin1=3; n=10; A=zeros(n); A(1:dmin1:end,1:dmin1:end)=1; disp(A)

6 years ago | 0

| accepted

Answered
Extend a 20x1 structure to be a 20x10 structure
repmat(s,1,10);

6 years ago | 0

| accepted

Answered
Algorithm to extract linearly dependent columns in a matrix
Test matrix (10 x 6) with rank 4 M = rand(10,4)*rand(4,6) Automatic selection of independent columns of M [Q,R,p] = qr(M,'vec...

6 years ago | 2

Answered
Section an array into equal rows and changing simultaneously the values of each section.
Initial data >> M=randi(10,3,4) M = 1 3 9 4 6 10 3 4 8 8 5 6 ...

6 years ago | 0

Answered
Call vector by key
Work for me >> M=containers.Map('KeyType','double','valueType','any') M = Map with properties: Count: 0 ...

6 years ago | 0

| accepted

Answered
How I can find the index when both signals are high?
Assuming your signal are binary vectors of the same size b and r both = min(b,r); d = diff([0; both(:); 0]); upidx = find(d=...

6 years ago | 1

| accepted

Answered
Polyfit with other model
Generate test data x=linspace(0,1,100) P = [rand(1,3) 1] y=polyval(P,x) + 0.1*randn(size(x)); Fit polynomial (order n) y=P(x...

6 years ago | 0

Answered
create multiple submatrices from a large matrix
Probably better code using logical indexing M = rand(54,7056); [m,n] = size(M); pattern = circshift([true(1,9) false(1,7)],...

6 years ago | 1

| accepted

Answered
create multiple submatrices from a large matrix
M = rand(54,7056); [m,n] = size(M); offset = 7; offset = mod(offset,16); I=(-16:8:ceil(n/8)*8+offset+8); J=-offset+(0:15)...

6 years ago | 1

Answered
Network creation-Grid
Use MATLAB graph object

6 years ago | 0

| accepted

Answered
Is there any way to accelerate the solving of a series of large sparse positive definite linear equations "Ax=b" with same "A" and different "b"?
Two things come to my mind: Why can't you build all the b together then make a single inversion b = [b1 b2 ... bp] x = A \ b ...

6 years ago | 0

| accepted

Answered
How do i count same consecutive occurrences
Example: A=[1,1,1,1,1,2,2,2,2,3,3,3,3,2,2,2,1,1,1,1] Code d = diff([0, A==2, 0]); startidx = find(d==1) lgt = find(d==-1)-s...

6 years ago | 0

Answered
How to split a 3d matrix into sub-3d matrices?
probably you can use mat2cell IMO splitting a matrix in cell is rarely a good idea if you want your code works decenly in spee...

6 years ago | 0

Answered
Where has depfun gone? or How to make a dependency graph?
https://www.mathworks.com/help/matlab/matlab_prog/identify-dependencies.html https://www.mathworks.com/help/matlab/ref/matlab.c...

6 years ago | 0

Answered
random matrix with a given number of specified elements
User inputs matsz = [3,3]; n1 = 4; % number of desired 1s, no need to specify for 0s Generate B = zeros(matsz); % + 0; B(r...

6 years ago | 1

Answered
How to find a row of a large matrix
It seems you run old MATLAB version without auto-expansion capability. This will work for any version: row = find(ismember(X,[...

6 years ago | 0

| accepted

Answered
How can one extract this vector from a matrix?
Avg = mean(reshape(M(:,2:3)',12*2,[])); [(1:length(Avg)); Avg]'

6 years ago | 0

Answered
array indexing with another array in multidimensional matrices
A=randi(10,5,4,3,2) idx=[1,1;2,1;3,1;1,2;2,2;3,2] Then sz=size(A); Aidx = A(:,:,sub2ind(sz(3:4),idx(:,1),idx(:,2)))

6 years ago | 0

Answered
all possible combinations of vectors of unknown quantity and length
Generate vectors of consecutive integers to be combined A = [2 5 8 9]; c = arrayfun(@(n) 1:n, A, 'unif', 0) Generate combinat...

6 years ago | 0

| accepted

Answered
How do I obtain the derivatives after interp2 with the 'spline' option?
Checkout this File exchange I haven't visited this file for long time. At the time I wrote the interface is not very intuitive,...

6 years ago | 0

Answered
How can one make this program work? (fmin question)
x=zeros(10,1); for a=1:1:10 x(a,1)=fminbnd(@(x) fun(x,a), 0, 2) % minimizes fun(x,a) end

6 years ago | 1

| accepted

Answered
How to reshape matrix 2 columns by 2 columns
You want a reshape? Here is reshape method: B = reshape(permute(reshape(A,size(A,1),2,[]),[1 3 2]),[],2)

6 years ago | 0

Answered
Which is more efficient when applied to a sparse matrix, find or logical indexing ?
For sparse matrix using FIND to get non-zero elements is the best - bar none. It's design for it and the data are internally ran...

6 years ago | 1

| accepted

Answered
Particularly strange bug using the eval function
This is NOT a bug but documenented behavior from recent release Read from R2019b release note "If you intend to use x as a va...

6 years ago | 1

Answered
How do I get every combination of 3 vectors?
yourvector1 = ... yourvector2 = ... yourvector3 = ... Then c = {yourvector1, yourvector2, yourvector3}; c = flip(c); [c{:}...

6 years ago | 0

| accepted

Answered
How can ı solve this constraint optimization problem?
Hint: you should find x=y=1

6 years ago | 1

Load more