Answered
How can I find pairs of rows with the same values in certain columns?
k = diff(X); i0 = find(all(k(:,[1,6,7]) == 0,2) & k(:,10) ~= 0); out = permute(cat(3,X(i0,:),X(i0+1,:)),[3, 2, 1]); a...

11 years ago | 0

| accepted

Answered
Compare two matrix and delete the same rows
setdiff(B,A,'rows')

11 years ago | 3

Answered
how to find the start and end points of overlapping intervals in one array
a = [ 1.5000 95.5000; 82.5000 150.5000; 141.5000 197.5000; 191.5000 357.5000; 400.5000 438.5000; 415.5000 481.5000; 519.5000 6...

11 years ago | 1

| accepted

Answered
Calculating the average value for each year
I use Import Data from MATLAB menu (Home): [yy,~,c] = unique(FortStJamesv22{18:end,'Year'}); out = [yy, accumarray(c,Fo...

11 years ago | 0

Answered
How to get the intersection points of a line and a curve which was fit to data?
one way with |Curve Fitting Toolbox| array=[515 525 561 600 632 700 761 800 900 1000 1014 1750; 0 150 300 394 4...

11 years ago | 2

| accepted

Answered
Generate a cell with 10 elements
V = arrayfun(@(x)rem(x,2)*ones(x,1),randi([1 10],10,1),'un',0); Hi Silviya! For clarity, please read about MATLAB-functions...

11 years ago | 1

Answered
Calculate 10y returns out of monthly data
out = prod(1 + reshape(x,120,[])) - 1; or out = accumarray(ceil((1:numel(x))'/120),x(:),[],@(x)prod(1+x)-1);

11 years ago | 0

| accepted

Answered
How to compare the first column of the rows to whole matrix?
C = sum(bsxfun(@eq,A(:,1),reshape(A,1,[])),2);

11 years ago | 0

Answered
How to plot certain columns and rows from matrix
Let A your matrix with size 33 x 120 plot(A(1:3,25:35)')

11 years ago | 9

| accepted

Answered
Comparing a logical matrix and a numerical matrix?
mask(~mask) = 1/4; out = orig.*mask;

11 years ago | 0

Answered
How to replace NaN with column mean if less than b NaN in a column?
n = nanmean(MA); nn = isnan(MA); ii = sum(nn) < 4; z = MA(:,ii); z(nn(:,ii)) = nonzeros(bsxfun(@times,nn(:,ii),n(...

11 years ago | 1

| accepted

Answered
1D interpolation with non-monotonic scattered data
Use <http://www.mathworks.com/help/matlab/ref/griddedinterpolant-class.html |griddedInterpolant-class|> small example: x...

11 years ago | 0

| accepted

Answered
How can I generate all possible combinations of a matrix which have a certain value?
n = find(a==0); out = arrayfun(@(x)nchoosek(n,x),numel(n):-1:2,'un',0)

11 years ago | 0

| accepted

Answered
How to remove duplicate NaN values from an X Y data set
data=[1,2;3,4;nan,nan;5,6;nan,nan;nan,nan;7,8]; d = all(isnan(data),2); n = [0;diff(d)]; k = find(n == -1); m ...

11 years ago | 1

| accepted

Answered
How to add time from 2 arrays
C = {'a' 102 'a' 135 'a' 157 'b' 189 'b' 201 'a' 222 'a' 245 'b' 290} cn = [C{:,2}]'; [~,~,c1] ...

11 years ago | 0

| accepted

Answered
mean of matrix elements
I want have 'vote' too! out = accumarray(ceil((1:numel(x))'/10),x(:),[],@mean);

11 years ago | 1

Answered
how to check values in a cell is smaller than a certain number?
[EDIT] HDD = cell(size(E)); for jj = 1:numel(HDD) HDD{jj} = max(0,15.5 - E{jj}); end

11 years ago | 1

Answered
Multidimensional matrix from anonymous function
In your case, for create multidimensional array (4D), try following code: F=@(x,rho,phi,z) A(x).*(x.*Ym(beta(x).*rho)... ...

11 years ago | 0

Answered
number of elements of each unique values in a matrix
B = unique(A); out = [B,histc(A,B)];

11 years ago | 0

| accepted

Answered
How do you separate the roots of a function?
qx = input('input as double array [1 x 4] = '); dq = polyder(qx); r = roots(dq); use |r(1)| as |r1| and |r(2)| as |r2...

11 years ago | 2

Answered
how can i rotate an N-dimensional matrix?
A = cat(3,[1 2 3;4 5 6;7 8 9],[10 11 12;13 14 15;16 17 18]) out = permute(A,[3,1,2]); Please read about function <ht...

11 years ago | 2

| accepted

Answered
convert cell to vector that contains a function
syms r phi z; x = [r * cos(phi); r * sin(phi); z]; %new variables y = [r; phi; z]; ta = jacobian(x,y); b0 = ar...

11 years ago | 0

Answered
How to combine 8-bit binary sequence?
A = {'00001110' '00001110' '00001110' '00001110'}; B = cat(2,A{:}); or B = [A{:}];

11 years ago | 0

Answered
How to improve a for
f = -dot(Q,Q).'

12 years ago | 0

Answered
converting a minute chart
x - your array (4e6 x 6) n = ceil((1:size(x,1))'/2); out = [x(1:2:end,1:3), accumarray(n,x(:,4),[],@min),... ...

12 years ago | 1

| accepted

Answered
Function that returns an NxN matrix
for jj = N:-1:1 out(jj,jj) = 1; end

12 years ago | 1

| accepted

Answered
how to specify time and months for year long data ?
Let |data| - your array first column - 'year', second - 'month' ... fifth - 'temp' [de, ~,c] = unique(data(:,1:2),'rows'); ...

12 years ago | 0

| accepted

Answered
taking mean of certain range ignorning NaN in matrix
nn = ~isnan(X); ii = cumsum(nn).*nn; out = mean(reshape(X(ii >= 1 & ii <= 25),25,[])); other way X = phidp; k...

12 years ago | 0

| accepted

Answered
How to vectorize the following code
a = reshape([RMH.D],[],numel(RMD))';

12 years ago | 0

| accepted

Load more