Community Profile

photo

Andrei Bobrov


4,616 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 do I create a random row matrix with some fixed positions?
a = [ 11 3 14]; b = 1:20; c = setdiff(b,a); n = numel(c); out = [a, c(randperm(n))];

약 7시간 ago | 0

| accepted

Answered
Rearrange matrix and concatenate cells
If your datadimer is table: A = datadimer{:,:}; sZ = 291; [m,n] = size(A); k = m/sZ; out = reshape(permute(reshape(A,sZ,k,n...

약 8시간 ago | 0

Answered
return row index of values greater than 0 to a 3 dimensional array
[ii,jj] = find(A > 0); out = accumarray(ii,jj,[],@(x){sort(x)'}); out{:}

약 8시간 ago | 0

Answered
How to crop matrices at the maximal non-NaN values and then center the data
M = struct2cell(H); n = min(cellfun(@(x)find(any(isnan(x),2),1,'first')-1,M)); for jj = 1:numel(H) H(jj).matrix = H(jj).m...

약 9시간 ago | 1

| accepted

Answered
How to concentrate matrices of different row length (same column length) into one matrix by unfolding each of the matrices to the smallest row length conatining numbers not nan
M = struct2cell(H); n = min(cellfun(@(x)find(all(~isnan(x),2),1,'last'),M)); M = cellfun(@(x)reshape(x(1:n,:)',1,[]),M,'un',0)...

1일 ago | 1

| accepted

Answered
How can I extract the time column of a timetable
variant a = rand(20,6); date1 = datetime(2019,4,19) + hours(cumsum(70*rand(20,1))); TT = array2timetable(a,'RowTimes',date1...

1일 ago | 1

| accepted

Answered
combining two text file with 100 equal number of header and body text
z = dir('file*_.txt'); zn = {z.name}; n = numel(zn); c = cell(n,1); for jj = 1:numel(zn) f1 = fopen(zn{jj}); k = t...

3일 ago | 0

Answered
How to assign NaN for empty cells in an array?
Finalanswer = ismember(T.Icnum,moga);

3일 ago | 0

Answered
How does Matrix(3002:2001:1999998)=0.4 works?
[ii,jj] = ind2sub([1000,2000],3002:2001:1999998); A = sparse(ii,jj,.4,1000,2000);

3일 ago | 0

Answered
Matrix problem with my vectors
theta = (-5:5:25)';%+ n = numel(theta); N = [-0.906 1.43 2.78 4.20 5.03 5.28 -2.49 0.889 4.16 7.71 11.0 7.30 12.7]*4.45; FN_c...

4일 ago | 0

Answered
How to subtract a number from a previous one
x = [1;.75;.5;.6]; n = filter(1,[1;1],x); or out = tril(toeplitz(x))*(-1).^(2:numel(x)+1).'; or n = x; for jj = 2:numel(...

4일 ago | 2

| accepted

Answered
how to adjust the conv filtered data same like origanal data?
con=conv(h,L,'same');

4일 ago | 0

| accepted

Answered
how to count the number of element in observation and make summation?
K = B.TotalRevenue.*ones(size(B,1),3)/3; [a1,~,c1] = unique(B{:,1:3}); out = table(a1,accumarray(c1,K(:)),'v',{'opals','Revenu...

4일 ago | 0

| accepted

Answered
Create This Matrix to N-Value
n = 3; out = flip(fullfact([n, n]),2) - 1; or [x,y] = ndgrid(0:n-1); out = [y(:),x(:)];

5일 ago | 0

| accepted

Answered
How to extend/add elements to an array?
A = [2 3 4 5 0 1 4 5 5 0 3 4 0 2 0 ]; B = [3 2 3 5]; out = A(sort([find(A),repelem(find(A == 0),B)]));

5일 ago | 0

| accepted

Answered
sort a matrix depending on first row
out = sortrows(B.',1).' variant [~,inx]=sort(B(1,:)); out = B(:,inx);

11일 ago | 10

Answered
comparison of the datasets
T = readtable('example.xlsx','sheet',1); T2 = readtable('example.xlsx','sheet',2); R12 = unique([T2.R1;T2.R2+eps(1e3)]); C = ...

12일 ago | 0

| accepted

Answered
Data manipulation problem?
d = fopen('Data.csv'); c = textscan(d,'%s','delimiter','\n'); fclose(d); c=c{:}; x = regexp(c,'\-?\d+(\.\d+)?([Ee][+-]...

19일 ago | 0

Answered
Average over duplicate values in xlsx file
T = readtable('yourfile.xlsx'); T_out1 = varfun(@(x)x(1),T,'I',1:14,'G','StimuliName'); T_out2 = varfun(@mean,T,'I',15:18,'G...

19일 ago | 0

Answered
how to Interpolate hourly data
T = readtable('test.txt','ReadVariableNames',false,... 'Format','%d %d %d %f %f %f %f %f'); time1 =...

21일 ago | 1

| accepted

Answered
How to obtain sum over coalition?
Variant for your new data from example.mat (B). BB = B{:,1:2}; abc = unique(BB(:)); n = numel(abc); C = cell(n,1); for ii =...

21일 ago | 1

Answered
The meaning of a length command
It's length of vector 'w'. >> w = 1.1:.01:1.9; >> length(w) ans = 81 >>

21일 ago | 0

| accepted

Answered
How to separate a vector into positive and negative vectors using a for loop?
x = [-3.6 10 3 -1 11.4 0 7 -9.5 2 15 -1 3]; y = strings(numel(x),1); for ii = 1:length(x) if x(ii) >= 0 y(ii) =...

21일 ago | 0

Answered
How to form a for-loop to: find the onset (first element) of trials of zeros, ones and twos, in an array of sequences of zeros, ones and twos
n = numel(E); count1 = 1; start_of_trial = [1;zeros(n-1,1)]; trial_value = zeros(n,1); for ii = 2:n if E(ii) - E(ii-1) ...

21일 ago | 0

| accepted

Answered
How to seasonalise daily weather classification and precipitation data
Where KNG01date_d? date1 = datetime(KNG01date_d,'ConvertFrom','datenum'); TT = array2timetable(KNG01rain_d,'RowTimes',date1...

22일 ago | 0

Answered
How to use a for-loop to find the onset (first element) of trials of zeros, ones and twos, in an array of sequences of zeros, ones and twos
function [start_of_trial, trial_value] = find_onsets(E) start_of_trial = find([1;diff(E(:))~= 0]); trial_value = E(sta...

22일 ago | 2

Answered
Substracting the value of upper row from all the values from the subsequent rows individually ?
A =[ 2130.18 2217.22 2334.24 2433.29]; out = A(2:end) - A(1);

22일 ago | 0

| accepted

Answered
how to select the highest values form each column and set the other values to zero.
[m,n] = size(A); [~,ii] = sort(A); A(bsxfun(@plus,ii(1:end-2,:),(0:n-1)*m)) = 0; or [m,n] = size(A); [~,ii] = sort(A); A(i...

23일 ago | 0

| accepted

Answered
How replace NaN's in a 3d field with the nearest value in the same column?
B = reshape(T,[],1); lo = ~isnan(T); ii = find(lo); C = interp1(ii,B(lo),(1:numel(B))','previous'); T_out = reshape(C,size(T...

24일 ago | 0

| accepted

Answered
How to obtain sum over coalition?
s = string(('a':'d')'); ss = s([1 ,2;2,3;2,4;1,4]); v = [20,10,15,10]'; C = cell(4,1); for ii = 1:4 k = num2cell(nchoos...

24일 ago | 0

| accepted

Load more