Community Profile

photo

Andrei Bobrov


4,746 total contributions since 2011

Andrei Bobrov's Badges

  • Thankful Level 3
  • Master
  • 36 Month Streak
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer
  • Scavenger Finisher
  • CUP Challenge Master
  • Commenter
  • Leader
  • Speed Demon
  • Solver

View details...

Contributions in
View by

Answered
How select a first value from the binary matrix ?
out = cumsum(cumsum(matrix)) == 1;

약 1시간 ago | 1

Answered
Find Number of Elements in an Array
A = {'KM'; 'KL'; 'MN'; 'KM'; 'MM'; 'KL'}; out = varfun(@x,table(A),'GroupingVariables','A')

약 24시간 ago | 0

Answered
Splitting one column into multiple columns
input = {'0.17 1.7285 0.001763792 1.000977 56651.41 0.000017652 DHT11, OK, 35.0,'; ...

4일 ago | 1

Answered
Resample datetime to minute resolution
T = fuel1(:,{'Start','Volume'}); T.Properties.VariableNames={'time','vol'}; T1=table; T1.time = fuel1.End; T1.vol = zeros(si...

4일 ago | 1

| accepted

Answered
How to organize a table?
T = readtable('img1.txt'); out = varfun(@sum,T,'GroupingVariables',... {'time','cell_type'},'InputVariables','cell_t...

4일 ago | 0

Answered
work with matrix of words and number
T = readtable('txtfile.txt') T_out = varfun(@mean,T,'GroupingVariables','Var1');

5일 ago | 0

| accepted

Answered
Interleaving Vectors in MATLAB
Without loop: A = [1 2 4];B = [5 6 7]; C = [A;B]; C = C(:)'; with loop: for ii = numel(A):-1:1 C(2*ii-[0 1]) = [B(i...

5일 ago | 0

Answered
To generate alternate 0's and 1's
out = repelem(mod(0:numel(A)-1,2),A);

6일 ago | 6

| accepted

Answered
Data filtering(Cut from half length of index until next index )
data2 = data(cell2mat(accumarray(data(:,1),... (1:size(data,1))',[],@(x){x(1:ceil(numel(x)/2))})),:);

6일 ago | 2

| accepted

Answered
Manipulate matrix of different dimension
mm = [0 0 1;1 2 5;0 2 3 ;0 3 4; 0 4 5]; m = size(mm,1); n = max(mm(:)); lo = eye(m,n) ~= 0; M = zeros(m,n); [ii,~,v]=find...

7일 ago | 0

| accepted

Answered
Double = in one line of code
b = 1000; zz = {b}; [a,c] = zz{[1,1]};

7일 ago | 2

Answered
Matrix calculation indexing conditional
Let A - your array (500 x 6): T = array2table(A); T_out = varfun(@sum,T,'InputVariables',2,'GroupingVariables',3:4);

7일 ago | 0

Answered
Find a series of consecutive numbers and change index of them
[~,~,Data(:,1)] = unique(cumsum(Data(:,1)) - Data(:,2),'stable');

8일 ago | 1

Answered
How to apply a matlab code on a matrix if it already working on column vector.
[r,c] = size(MM); m = MM; m(m == 0) = nan; %lo -define the indices of the values that need to be changed: lo = fillmissing(...

8일 ago | 1

| accepted

Answered
How to assign vectors to existing vector
Let X - interval for input data in 'vector_2' X = [0, 15]; x = setdiff(X(1):X(2),vector_1); % input data newvector_2 = vector...

8일 ago | 0

Answered
List combinations and count how many it appears
YY = Y(W~=0,:); n = sum(YY>0,2); k = factorial(n)./factorial(n-2)/2; ie = cumsum(k); ib = ie - k + 1; zc = zeros(ie(end),2)...

11일 ago | 0

| accepted

Answered
Find values in a 3D array based on values in a seperate 3D array
lo = M_data == 1; [ii,jj,k] = ind2sub(size(M_data),find(lo)); output = [ii,jj,k,B_data(lo)];

12일 ago | 1

| accepted

Answered
Finding maximum value in a sequence
A = randi(1000,1,8); k = A(1); for ii = 2:numel(A) if k < A(ii) k = A(ii); end end

12일 ago | 0

Answered
adding multiple arrays into one big array
s1 = size(A1); s2 = size(A2); s22 = max(s1(2),s2(2)); A = [A1,zeros(s1(1),s22 - s1(2));A2,zeros(s2(1),s22 - s2(2))];

12일 ago | 1

| accepted

Answered
How to stop finding a value once it has been attained? (Find function inside a loop)
Please read about break in while loop.

12일 ago | 0

Answered
How do I make a block diagonal matrix using blkdiag function for a N dimensions
C = repmat({A},n,1); out = blkdiag(C{:});

16일 ago | 0

| accepted

Answered
Looping through numbers in file and adding first two numbers then next two and so on
conv(A,[1,1],'valid') or b = movsum(A,2); out = b(2:end);

18일 ago | 0

Answered
How can i classify my data?
a = [ 0.47 15.905 8.434 14.018 1010.803 1458.32 148.46 0.34 18.346 8.282 16.443 1012.711 1460.69 140.41 0.4 17.45...

18일 ago | 0

| accepted

Answered
A doubt regarding a simple For loop indexing for certain rows only.
lo = a(:,3) == 4; ii = cumsum([0;diff(lo) == 1]).*lo; m = max(ii); ii(ii == 0) = m + 1; out = a(ii >= m,:);

19일 ago | 1

Answered
Coud anyone help me to solve the issue.
One variant: [m,n] = size(A); [~,ii] = sort(rand(m-1,n)); B = A(2:end,:); An = [A(1,:);B(ii + (m-1)*(0:n-1))];% ATTENTION! I...

19일 ago | 1

| accepted

Answered
Problem with matrices. Double and cell
for ii = 1:numel(CT) if ~iscell(CT{ii}) CT{ii} = num2cell(CT{ii}); end end T = cell2table(cat(2,CT{:})); w...

19일 ago | 1

| accepted

Answered
How to convert a table into a structure
t2 = varfun(@(x){x(:)'},T,'GroupingVariables','Name'); TinStrr = t2(:,[1,3:end]); TinStrr.Properties.VariableNames = T.Propert...

19일 ago | 0

| accepted

Answered
How to manipulate a matrix under certain conditions to fills gaps with numbers.
Let MM - your 'required colum'. MM =[3,3,0,0,3,3,0,0,0,3,3,0,0,3,3,0,0,3,0]'; m = MM; m(m == 0) = nan; %lo - define the ...

19일 ago | 1

| accepted

Answered
how to fill gaps of rows with 3s of a matrix under certain conditions.
Let M = [0 0 3 3 0 0 0 3 0 0 0 0 3 0 3 0 3 0 ...

20일 ago | 1

| accepted

Answered
convert array 3d array into 3 column(ranked)
SPEED=[1 2]' TRQ=[10 20 30] Z=[0 1;3 5; 4 3] [x,y] = ndgrid(TRQ,SPEED); T = array2table([y(:),x(:),Z(:)],'VariableNames',{...

20일 ago | 1

| accepted

Load more