Community Profile

photo

Andrei Bobrov


4,530 total contributions since 2011

Andrei Bobrov's Badges

  • Master
  • 36 Month Streak
  • Thankful Level 2
  • 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 can I convert a cell array into a double array
out = cell2mat(cellfun(@(x)cell2mat(cat(1,x{:})).',CellMatrix,'un',0));

약 17시간 ago | 1

| accepted

Answered
Checkin for equal values in the same column
T = array2table(A); m = varfun(@mean,T,'GroupingVariables',1); out = A; out(:,2:end) = out(:,2:end) - m{A(:,1),3:end};

약 22시간 ago | 0

| accepted

Answered
How to calculate sum of all the possible combinations of two vector elements
log(kron(exp(B),exp(A)))

3일 ago | 0

| accepted

Answered
creating a nested loop to change values within a for loop
[ii,k,jj] = size(young_50); yy = permute(young_50,[2,3,1]); y1 = reshape(yy(:,[1,3:end],:),k,[]); b = squeeze(yy(:,2,:)); p ...

3일 ago | 0

Answered
find row with certain value and put in cell
z = B.*permute(A,[1,3,2]); [~,jj] = ndgrid(1:size(A,1)*2,1:size(A,2)); out = accumarray(jj(:),z(:),[],@(x){unique(x(x~=0))});

4일 ago | 0

Answered
How can I equate all values of one vector to another and get the value ? Please find the example below
dataA = [-496,-636,-52,175,-84,-248,-555,-423,34,-174]'; dataB = [-0.399609375000000,-0.512402343750000,-0.0418945312500000,......

4일 ago | 0

| accepted

Answered
How to generate all pairwise differences between two vectors
out = (a(:)' - b(:))./b(:)*100;

7일 ago | 0

Answered
convert cell to array
out = cat(1,A{:}); out = out(out ~= 0);

7일 ago | 0

| accepted

Answered
How to find first non repeated (unique) character in a string?
z = 'hello'; [a,~,c] = unique(z,'stable'); out = a(find(accumarray(c,1) == 1,1));

8일 ago | 1

Answered
extract the 16 elements (4 by 4 matrix) from a big matrix
n = 4; s = size(A,1); out = reshape(A',s,n,[]); Here: out(:,:,1) -> B, out(:,:,2) -> C, out(:,:,3) -> D and etc.

10일 ago | 0

Answered
how to check symmetric for vector or array with 1 dimension
isequal(A(:),flip(A(:)));

10일 ago | 0

Answered
How to compare each element of a matrix with a number? And then star it out
a = [1 2 3 4 5 6 7]'; c = 6; lo = a >= c; z = ["","*"]'; out = a + z(lo+1);

14일 ago | 1

Answered
How to generate all pairwise differences between two vectors
out = a(:) - b(:)';

15일 ago | 1

Answered
Find common elements between two vectors and extract data from matrix (vectorized)
A3 = fix(A2.*(10.^-floor(log10(A2)))); [ii,~] = find(squeeze(all(A3==reshape(B,1,1,[])))); [~,~,c] = unique(ii,'stable'); jj ...

17일 ago | 0

| accepted

Answered
Matrix manipulation (matrix A to B format)
AA = [A,repmat([1,0],size(A,1),1)]; A3 = reshape(kron(AA,[1;1]),[],2,2); A3(2:2:end,:,:) = flip(A3(2:2:end,:,:),2).*[-1,1]; B...

17일 ago | 1

| accepted

Answered
Program that separates even and odd numbers and shows them in two vectors.
n = (1:100)'; lo = rem(n,2)==1; pares = n(~lo); impares = n(lo);

17일 ago | 1

| accepted

Answered
how to detect index of the max amplitude?
[out,ii] = max(A); out_ind = index(ii);

21일 ago | 1

| accepted

Answered
how to create this vector?
X=[0 0 0 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1]; Y=[3 6 5]; Y2 = [0,Y]; out = Y2(bwlabel(X) + 1);

22일 ago | 1

| accepted

Answered
Scatter data interpolation of a column matrix
T = readtable('torque.xlsx','ReadV',0); torquei = xlsread('torquei.xlsx'); throttle= [0 2.5 5 10 15 20 30 40 50 60 65 70 75 80...

23일 ago | 0

| accepted

Answered
extract elements from four matrices and create new matrix
Let A,B,C,D - your matrix (4 x 4). out = reshepe(permute(cat(3,A,B,C,D),[3,1,2]),2,2,[]); or out = reshepe(permute(cat(3,A,B,...

23일 ago | 0

Answered
Replace elements of a matrix
A = [1 4 3; 2 3 2;4 2 1;10,7,1]; b = [4 ,10 3 , 15 2 ,20 1 , 30]; [lo,ii] = ismember(A,b(:,1)); A(lo) = b(ii(lo),2); ...

23일 ago | 2

| accepted

Answered
How to linearly change values in matrix
toeplitz(1:-.1:.6) or 1 - abs((1:5) - (1:5)')*.1

24일 ago | 0

| accepted

Answered
How to merge a datetime array with a table
out = table2timetable(Result,'RowTimes',DT);

26일 ago | 0

| accepted

Answered
How to chang matrix size 81x81x30 to 81x81x32 by add row
daily_avg_u(:,:,end + (1:2)) = zeros([size(daily_avg_u(:,:,1)),2]);

26일 ago | 1

| accepted

Answered
Averaging and summing parts of a column based on date
T = readtable('Matlab question.xlsx','Ra','A2:B109','ReadV',0); out = rowfun(@tempfun,T,'G','Var1',... 'OutputV',... ...

28일 ago | 0

Answered
I am getting error in integrating a function from 0 to infinity wrt x. Kindly help.
Try q = integral(fun,0,Inf,'ArrayValued',1); but in your case the result is a zero vector, due to value of the gamma = 0.

29일 ago | 0

| accepted

Answered
grouped average in arrays
Old MATLAB T = table(A(:),repelem(string(['a':'d','b']'),[3,3,2,3,1]),'v',{'A','B'}); outT = varfun(@mean,T,'G',2);

29일 ago | 0

Answered
Sum specific rows of an array
A = [0.2 2 3 1 3 4 1 4 6 0.8 4 6 2 5 1 1 6 2 0.4 6 2]; [a,~,c] = uniq...

29일 ago | 0

| accepted

Load more