Answered
Generating sequences from data
xy = [5 14 6 16 1 16 6 11 4 16 1 16 2 13]; n = 5; [m,k] = size(xy);...

6 years ago | 0

| accepted

Answered
Combining several asymmetric matrices to fit each other
m = [1 1 1 1 1 1 1 1 1 NaN 1 1 1 NaN NaN 1 1 NaN NaN NaN ...

6 years ago | 2

Answered
How to compare two vectors on distance and isolate consecutive segments?
d = abs(A(:) - B(:)') <= 40; loA = any(d,2); loB = any(d,1); output = zeros(nnz([loA(:);loB(:)]),1); output(1:2:end) = A(loA...

6 years ago | 1

Answered
Masking an array back to a selected region in a Matrix
out = double(region); out(region) = vdisp_selected;

6 years ago | 0

| accepted

Answered
How do I subtract two 2D data sets with different resolutions?
PP1 = interp1(T1,P1,T2); dP21_out = P2 - PP1; plot(T2,P2); hold on plot(T2,PP1);

6 years ago | 0

| accepted

Answered
i want to calculate of mean each block row vice and i need to replace each row with obtained mean value
Let A - your array: A = randi(125,8,6); out = mean(A,2)*ones(1,size(A,2));

6 years ago | 0

Answered
How to create a block diagonal matrix without using cell array?
A(:,:,1) = [1 2 3 ; 4 5 6]; A(:,:,2) = [7 8 9 ; 10 11 12]; C = num2cell(A,[1,2]); B = blkdiag(C{:}); or for your case (A -...

6 years ago | 0

| accepted

Answered
Nearest value from an array.
M=[1,2,3,4,5,6,7,8,910] N=[0.5,1.3,2.4] [~,ii] = min(abs(M(:) - N(:)')); out = M(unique(ii));

6 years ago | 0

| accepted

Answered
Selecting cross values from two arrays
s = [0,1000,2000]; d = [0,1000,2000]; J = [0,5000,8000]; ii = fullfact([3,3,3]); out = [s(ii(:,1))',d(ii(:,2))',J(ii(:,...

6 years ago | 0

Answered
Sample data from time-dependent array
data = [ 228.0000 23.7800 236.0000 23.8767 244.0000 23.9400 256.0000 24.1400 268.0000 23.8200 276.0000 2...

6 years ago | 0

| accepted

Answered
How to extract first non-zero element in each column and put into a new array
out = in(cumsum(cumsum(in~=0)) == 1)'

6 years ago | 1

Answered
Finding index location in volume?
x = 2000:0.5:2004; y = 45000:0.3:45009; z = 10:0.2:12; x0 = 2002.13; y0 = 45006.811; z0 = 11.36; C = nan(9,31,11); ...

6 years ago | 1

| accepted

Answered
How to loop this operation ?
ii = 300:-20:20; D = TarG(ii)./[100;TarG(ii(2:end) + 1)]; Tot_TarG = cumprod(D);

6 years ago | 1

| accepted

Answered
I have time series data of 1 year each day 2880 values row wise so a matrix of 365X2880. I want to do monthly average. January 31 days average one file of one month, so that I can finally get 12 files each of monthly average.
A - you're array 365 x 2880, in example per 2015 year. t = (datetime(2015,1,1):datetime(2015,12,31))'; TT = array2timetable(A,...

6 years ago | 1

| accepted

Answered
getting the max and its positions from a 4D array
Maybe this: [m,n,k,f] = size(totalDistance);% here k = 1 [~,ij] = max(totalDistance,[],4); [I,J,K] = ndgrid(1:m,1:n,1:3); F ...

6 years ago | 0

Answered
sum of timetables for each months
Buses = [5;8]; cars = [10;18]; Time = datetime(2019,[8;9],1); buses = timetable(Time,Buses); cars = timetable(Time,cars); ...

6 years ago | 1

| accepted

Answered
sub2ind Get values of 3D matrix using an index array?
[m,n,k] = size(M); [q,w] = ndgrid(1:m,1:n); out = M(sub2ind([m,n,k],q,w,A));

6 years ago | 2

| accepted

Answered
List(Vecor) Generation
m=3; n=4; T = 1:m*n; out = ceil(T/m) + mod(T-1,m); or out = floor(T/n) + mod(T-1,m) + 1; or out = repmat(1:m,1,n) + rep...

6 years ago | 0

Answered
HOW Calculate the distance of points form one center in 2-D space and display output in a distance matrix?
X = rand(5,1) Y = rand(5,1) D = squareform(pdist([X,Y])) or XY = [X, Y]; D = sqrt(squeeze(sum((XY - permute(XY,[3,2,1])).^2...

6 years ago | 1

Answered
How can I convert this table to a cell array as shown in the screenshot?
tout = varfun(@(x){x(:)'},T,'GroupingVariables','id'); C = tout{:,3:end}; measure = C(:,1); t = C(:,2);

6 years ago | 2

| accepted

Answered
for loop values of certain output range
x = 3; c = -2:1:2; q = -2:1:2; g = c*x + q.*(c+x); lo = g >= 5 & g <= 10; out = table(c(lo),q(lo),g(lo),'Variablenames',{'c...

6 years ago | 0

Answered
Reading content of a file using readtable return NaT for Time
T = readtable('eventlog.txt','format',... '%d %{yyyy-MM-dd HH:mm:SS}D %s %s %s','delimiter','|',... ...

6 years ago | 0

Answered
Creating a matrix having repeating elements
A = kron(eye(5),[1;1])+kron(diag(-ones(4,1),1),[1;1]); out = A(1:5,:); or n = 1:5; A = repmat([1,-1,0,0,0],5,1); out = A(mo...

6 years ago | 1

| accepted

Answered
How to cite the row of the matrix by vectorization?
For large matrices, the cycle may be faster. a = repmat(1:6,3,1)'; index = [1:3;2:4]; si = size(index); result = permute...

6 years ago | 0

| accepted

Answered
inserting rows in a matrix
kron(yourmatrix(:),[1;zeros(24,1)]);

6 years ago | 1

Answered
General Binomial Matrix Manipulation
Aend = reshape(Abegin.*permute(Abegin,[1,3,2]),size(Abegin,1),[]);

6 years ago | 1

Answered
A cycle for creating and working with zones
n = numel(Data); ii = ceil((1:n)'/100); TF = accumarray(ii,Data(:),[],@(x){isoutlier(x)});

6 years ago | 0

| accepted

Answered
array manipulation in loop through a sequence
E = ones(4); n = size(E,1); for ii = 1:n E(ii,n-ii+1:n) = E(ii - 1 + (ii == 1),n-ii+1:n) + 1 end

6 years ago | 1

| accepted

Answered
Matrix problem for same values of column
[m,n] = size(A); B = [(1:m)',A(:,2:3)]; k = B(1,2:3); ii = 1; C{1} = []; while ~isempty(B) i0 = ismember(B(:,2:3),k); ...

6 years ago | 0

Answered
function to fill in zeros
data=[100 95 0 90 0 85 0 0 70 65 ]'; data(data == 0) = nan; new_data = fillmissing(data,'linear'); or ii = (1:numel(data))...

6 years ago | 2

| accepted

Load more