Community Profile

# Andrei Bobrov

4.823 total contributions since 2011

View details...

Contributions in
View by

how to find nearest date and its corresponding value !

35 minutos ago | 0

Help me with this problem
Theta = 75; % degrees va = 600; % km/h vb = 500; % km/h v_b_to_a = vb*exp(1i*(Theta/180 - 1)*pi) - va; V_b_to_a = abs(v_...

alrededor de 2 horas ago | 0

Making a vector out of all even and odd numbers using for, if
lo = logical(mod(vect,2)); vect_even = vect(~lo); vect_odd = vect(lo);

alrededor de 3 horas ago | 0

what loop to use to make the code\input repeat again ?
while true a=5 ; disp(' '); i = input('choose a number '); disp(' '); if i == a disp ('RR'); ...

alrededor de 7 horas ago | 0

how to replace the element with random number based if statement
mutC = mut1; [m,n] = size(mut1); pm = 0.5; rmi = rand(m,n); rCm = rbC+(raC-rbC).*rand(m,n); for i = 1:numel(mut1) if r...

alrededor de 9 horas ago | 1

| accepted

How to write only non-NaN columns into Excel
T_in_Excel = T1(:,any(~isnan(T1{:,:}))); writetable(T_in_Excel, File_W)

1 día ago | 0

replace duplicate value by 0 in matrix or vector
b = [1 2 1 3]; [a,c] = unique(b,'first'); out = zeros(size(b)); out(c) = a;

1 día ago | 0

Could anyone help me with a code to check if the time intervals intersect
M = sortrows(list); out = M(sum(squeeze(any(M - permute(M,[3,2,1]) <= 0,2))) == 1:size(list,1),:);

1 día ago | 0

| accepted

A = [1,2,3;4,5,6;7,8,9]; B = [2,3,4,5]; D = reshape(permute(A + reshape(B,1,1,[]),[2,1,3]),size(A,2),[])';

1 día ago | 0

| accepted

classify array elements without so many if statement
out = discretize(A,0:.5:8)

1 día ago | 0

| accepted

Get index of smallest vlaue in each cell of cell array
Let cell_array - your cell array (40 x 1). cellfun(@(x)find(min(x) == x),cell_array)

1 día ago | 2

| accepted

could anyone help me how to update the array values with respect to the following arrays
a = (1:max(C))'; b = accumarray(C,1); i = a(accumarray(C,1) > 1); [lo,ii] = ismember(C,i); AA = A(lo,:); [iii,j] = ndgrid(i...

1 día ago | 0

Create a matrix on the basis of other matrix
[~,j] = find(M); C = accumarray(j,M(M ~= 0),[],@(x){unique(x,'stable')}) if all(diff(cellfun(@numel,C)) == 0) C = [C{:}];...

2 días ago | 0

How to specify a number to the specified position in the array？
a = [2 3 5 7 11]; out = [a;flip(a,2)]; out = out(1:numel(a));

2 días ago | 0

| accepted

Return a vector with the same size as the indexing matrix/vector (code optimization)
General case: out = reshape(V(index),size(index)); For your case V - vector (n x 1): if size(index,1) == 1 out = V(index...

2 días ago | 1

Use vec = -1:-1:-5 or vec = -(1:5)

2 días ago | 0

Finding and counting of identical rows in a matrix
For Octave? M = [ 1 300 3500 500 6000 3 200 3000 500 6500 5 150 2500 450 6000 8 400 2000 550 5500 5 200 3000 500 6500 ...

5 días ago | 1

| accepted

Collect double values of a matrix
Let xyz - your array (n x 3); [~,~,c] = unique(xyz(:,[1,3]),'rows','stable'); % c - serial numbers of rows with same values in ...

7 días ago | 0

Another Datetime conversion problem!
DateStrings = '2019-10-04T11:41:06+01:00'; convertDATETIME=datetime(DateStrings,'InputFormat',... 'uuuu-MM-dd...

7 días ago | 0

| accepted

Finding consecutive data with non zero in array
for R2013a (and for your data from all_data.txt) f = fopen('all_data.txt'); Data = textscan(f,'%f %f %f %f %f %f %f','CollectO...

11 días ago | 0

| accepted

Rearrange randomly just some parts of an array
C = [1 2 1 2 1 2 1 2 4 2 4 2 4 2 4 2 6 2 6 2 6 7 6 7 6 7 6 7 7 7 7 7 8 8 8 8 9 9 9 9 ]; CC = [C(:);max(C(:))+1]; j = 1; for...

13 días ago | 0

| accepted

Delete some specific numbers from an array
A = [10 9 5 5 7 3 5 8 3 5 6 3 7 10 ]; B = sign(diff(A(hankel(1:3,3:numel(A)))',1,2)); out = A( [true; prod(B,2) ~= 1 ; true...

13 días ago | 0

Help creating a vector in a loop
n = numel(A); new_vector = zeros(25,n); for ii = 1:n new_vector(:,ii) = linspace(A(ii),B(ii),25); end

14 días ago | 0

Subscript indices must either be real positive integers or logicals. how can i change? thanks!
ii(1) = v0; %initial condition for loop=2:N %recursive ii(loop) = ii(loop-1) + Vs*dt*/L - ii(loop-1)*R/L; end

14 días ago | 0

How to randomly place ones in specified postions of a matrix?
1. k = 10; [m,n] = size(A); [i1,j1] = ndgrid(1:m,1:2); [i2,j2] = ndgrid(1:3,3:n); ii = sub2ind([m,n], [i1(:);i2(:)],[j1(:);...

14 días ago | 0

| accepted

Error in Vector Multiplication of Complex Numbers
>> [a,b]*[a;b] ans = -3 >> [a,b]*[a,b].' ans = -3 >> [a,b]*transpose([a,b]) ans = -3 >> [a,b].' ans = ...

15 días ago | 0

| accepted

How to calculate averaged values from 5-min interval values
T = readtable('parko_hourly_1_1_2015_eos_16_5_2015_T_RH MINE.xlsx','sheet','Φύλλο1'); T = T(~isnan(T.minute),[1:5,7:8]); T.YEA...

15 días ago | 0

how to apply two statement in if loop?
if all(A(:)>0) & all(ismember(A(:),B(:))==0) .. end

16 días ago | 1

| accepted

Rearrange elements in an array based on another array
s = sum(M,2); v = V.*(M == 0); ss = s - sum(v,2); lo = ss > 0; n = sum(v == 0,2); a = fix(ss./n); b = mod(ss,n); add = ar...

20 días ago | 0

| accepted