Answered
import time and data from excel
[n,st] = xlsread('sandbox.xlsx',1,'A2:B9'); out = [datenum(st,'dd.mm.yyyy'),n];

10 years ago | 0

Answered
Adding month values to datetime function
out = datetime('now') + calmonths([3,6]) before R2014b out = addtodate(now ,[3,6],'month')

10 years ago | 2

Answered
assign vector to cell
New = num2cell(k)

10 years ago | 0

Answered
Pair comparison in from other rows
A = {A1,A2,A3}; C = cellfun(@(x) hankel(x(1:end-1),x(end-1:end)),A,'un',0); [a,~,c] = unique(cat(1,C{:}),'rows'); out...

10 years ago | 1

| accepted

Answered
Center day of each month
x = eomday(2001,1:12)'; out = [(1:12)',cumsum(x) - x/2 + .5];

10 years ago | 1

| accepted

Answered
How to remove the for loop in this code?
r = [-3.5 3.5]; a = [-5.5 5.5]; ep = 10; ti = bsxfun(@minus,tpol,permute(ipol,[3 2 1])); p = all([bsxfun(@gt,ti(:,...

10 years ago | 0

Answered
Building an array of the month number for every day of the year
[~,m,~] = datevec((datenum(2000,1,1):datenum(2000,12,31)).'); or [~,m,~] = datevec(datenum(2000,1,(1:366)')); or ...

10 years ago | 0

Answered
How to remove certain rows in permutation according to constraints?
A= [1 2 4 7 9 10 1 3 4 9 7 8 1 2 9 4 7 10 1 2 4 5 6 8 1 2 3 5 7 9 1 2 5 6 7 9] out = A(ma...

10 years ago | 0

Answered
creat a cell array so that each cell contain 3D matrix of 640x480x3
A - your 3D matrix out_cells = arrayfun(@(ii)A,1:44,'un',0)

10 years ago | 0

| accepted

Answered
Creating a Matrix from a given Vector.
h=[1, -0.5]; m = 3; % m - number of columns in out - matrix out = full(spdiags(ones(m,1)*fliplr(h(:)'),[-1 0],m + nume...

10 years ago | 0

Answered
Locate an element in an array
res = a(ismember(a(:,2),b(:,1)),:);

10 years ago | 0

| accepted

Answered
find index of cells containing other cells
A1 = cellfun(@(x)[x{:}]',A,'un',0); A1(cellfun(@isempty,A1)) = nan; m = cellfun(@numel,A); ii = cumsum(m); i1 = ii...

10 years ago | 0

Answered
Add column to a matrix
a =[ 0 1.0000 2.0000 2.4000 2.5000 3.0000 3.5000 4.8000 5.0000 ...

10 years ago | 1

| accepted

Answered
Make a function tha makes zero certain elements of the matrix corners as shown below
Please use |strel| from |Image Processing Toolbox| A = [17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 1...

10 years ago | 0

Answered
How to multiply cell matrix to obtain euclidean distance ?
sqrt(sum((cell2mat(cellE) - cell2mat(cellD)).^2,2))

10 years ago | 0

| accepted

Answered
How can I find the lowest number in a row and square the whole row?
A = randi(100,1,10); B = randi(100,1,10); C = [A; B]; [~,ii] = min(min(C,[],2)); out = C(ii,:).^2;

10 years ago | 0

Answered
How to create this specified matrix?
tril(toeplitz(u))

10 years ago | 0

Answered
Replace NaN with nearest numerical value to the left in the same row
lo = ~isnan(z); m = size(z,1); out = z(bsxfun(@plus,(cumsum(lo,2)-1)*m,(1:m)')); out(lo) = z(lo)

10 years ago | 1

| accepted

Answered
array operation for merging two arrays
union(intersect(data_1,data_2),data_3) or merge_data = data_1 merge_data(~ismember(merge_data,data_2)) = data_3

10 years ago | 0

| accepted

Answered
How do I execute my loop at a relatively short time?
Distance -> D Distance_Unique -> DU Residual_Squared -> RS Summation_Residual_Squared -> SRS Semivariance -> S ...

10 years ago | 1

| accepted

Answered
how to find and replace corresponding matri
out = cat(1,a1{:})

10 years ago | 0

Answered
How to draw a line on a logical matrix?
diag(5) or z = zeros(6.,7); a=[2 1]; b=[4 7]; xy = [a; b]; t = diff(xy); t0 = t(:,1)./t(:,2); y...

10 years ago | 0

Answered
How a(4)=2 and duplicate 2 four times?
a = [1 0 0 2 0 3 0 0 2]'; out = repelem(find(a),a(a > 0)) or a = [1 0 0 2 0 3 0 0 2]' t = a>0; a1 = a...

10 years ago | 0

| accepted

Answered
How to combine multiple cell array into a single cell array
out = cat(1,picarro{:})

10 years ago | 1

| accepted

Answered
Separate year in data
Let A - you data year1 = year(datenum(A,'dd.mm.yyyy'))

10 years ago | 0

| accepted

Answered
removing 0 from cellarray
out = a(~strcmp(a,'0'))

10 years ago | 0

| accepted

Answered
How to do this in Matlab?
x0 = [4,1,1,1,2,2,3,5,9,7,7,7,6,6,1,1,2,3,4,4]; n = 10; m = numel(x0) - n + 1; x1 = hankel(x0(1:end-n+1),x0(n+1:e...

10 years ago | 0

Answered
How to do sliding window operation in Matlab?
conv2(x,ones(1,10),'valid') add n = 10; out = hankel(x(1:end-n+1),x(n+1:end));

10 years ago | 0

Answered
How can i seperate columns by comparing the values of first row?
t = A(:,1) == 0; B = A(:,t) C = A(:,~t)

10 years ago | 1

| accepted

Answered
how can I interpolate?
use <http://se.mathworks.com/help/matlab/ref/scatteredinterpolant-class.html |scatteredInterpolant|> F = scatteredInterpola...

10 years ago | 0

Load more