Community Profile

# Andrei Bobrov

4 789 total contributions since 2011

null

View details...

Contributions in
View by

How to calculate averaged values from 5-min interval values
For old version of the MATLAB (MATLAB <= R2016a): T = readtable('Experiment.xlsx','ReadVariableNames',false); z = regexp(T.Va...

1 jour ago | 0

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));

2 jours ago | 0

| accepted

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(:,...

5 jours ago | 0

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...

5 jours ago | 0

| accepted

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

5 jours ago | 1

Finding consecutive data with non zero in array
x = ~xx(:); nn = numel(x); n = diff([find(diff([1;x(:)])~=0);nn+1]); y = mod(2 - x(1) +(0:numel(n)-1)',2); lo = repelem(~all...

6 jours ago | 0

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 jours ago | 1

| accepted

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

10 jours ago | 1

| accepted

Converting two matrix to a single table
T = table(reshape(M1',[],1),reshape(M2',[],1)); T.properties.VariableNames = {'M1_value','M2_value'};

10 jours ago | 0

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,...

10 jours ago | 1

| accepted

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 ...

10 jours ago | 0

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); ...

11 jours ago | 1

| accepted

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));

12 jours ago | 2

| accepted

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...

14 jours ago | 0

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...

14 jours ago | 1

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);

16 jours ago | 2

| accepted

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...

17 jours ago | 0

T = readtable('eventlog.txt','format',... '%d %{yyyy-MM-dd HH:mm:SS}D %s %s %s','delimiter','|',... ...

17 jours ago | 0

how to count daily events from a time series data
out = varfun(@(x)x,T,'GroupingVariables',{'Year','month','day'},... 'Inpu...

18 jours ago | 0

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...

18 jours ago | 1

| accepted

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...

18 jours ago | 0

| accepted

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

18 jours ago | 1

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

19 jours ago | 1

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

19 jours ago | 0

| accepted

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

19 jours ago | 1

| accepted

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); ...

20 jours ago | 0

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))...

20 jours ago | 2

| accepted

Averaging the previous 5 values of every 30 values in a matrix
m = size(numData,1); lo = mod((0:m-1)',30) + 1 >= 26; ii = ceil((1:m)'/10); HRmean5 = accumarray(ii(lo),numData(lo,3),[],@mea...

20 jours ago | 0