Answered

how can I find a specific data in time table in matlab?

out = data_mean_daily.Time(data_mean_daily.tabrizmat7 >= 2 );

how can I find a specific data in time table in matlab?

out = data_mean_daily.Time(data_mean_daily.tabrizmat7 >= 2 );

ongeveer 2 uur ago | 0

Answered

How to include a switch statement within a for loop?

% Parameters a_R = 0.0325; a_T = 0.0325; N_T = 164; N_R = 10; mu_0 = 4*pi*(10^-7); f_Array = [10000,20000,40000]; w = 2*p...

How to include a switch statement within a for loop?

% Parameters a_R = 0.0325; a_T = 0.0325; N_T = 164; N_R = 10; mu_0 = 4*pi*(10^-7); f_Array = [10000,20000,40000]; w = 2*p...

ongeveer 3 uur ago | 0

Answered

Integers without repeating consecutively

function [repPos, pinCodeFix] = pinCodeCheck(pinCode) lo = [true;diff(pinCode(:)) ~= 0]; repPos = find(~lo); pinC...

Integers without repeating consecutively

function [repPos, pinCodeFix] = pinCodeCheck(pinCode) lo = [true;diff(pinCode(:)) ~= 0]; repPos = find(~lo); pinC...

ongeveer 7 uur ago | 0

Answered

How can I insert a smaller ones matrix into a larger zeros matrix?

AA = [5:12;ones(5,1)*[0 8 8 8 0 5 5 5]] AA(end-1:end,1:5) = 1; AA(4,7) = 7; eq7 = AA == 7; le7 = AA <= 7; gt7 = AA > 7; ...

How can I insert a smaller ones matrix into a larger zeros matrix?

AA = [5:12;ones(5,1)*[0 8 8 8 0 5 5 5]] AA(end-1:end,1:5) = 1; AA(4,7) = 7; eq7 = AA == 7; le7 = AA <= 7; gt7 = AA > 7; ...

ongeveer 8 uur ago | 0

Answered

Averaging the data from a 3d matrix and populating it in a 2D matrix.

B = mean(A,3);

Averaging the data from a 3d matrix and populating it in a 2D matrix.

B = mean(A,3);

ongeveer 8 uur ago | 0

| accepted

Answered

Replace Number array with characters

volt = [18 33 31 34 15 37 10.5 48 50 38 35 39 42 33 31 1 5 9 13 11 27 35 -1 46 22 6 19 36]; edges = [-inf,0:10:40,inf]; frui...

Replace Number array with characters

volt = [18 33 31 34 15 37 10.5 48 50 38 35 39 42 33 31 1 5 9 13 11 27 35 -1 46 22 6 19 36]; edges = [-inf,0:10:40,inf]; frui...

ongeveer 8 uur ago | 0

Answered

Filtering rows of a table by giving a constraint to a particular column

FiltereddataofTable = A(A.Alpha > 100,:);

Filtering rows of a table by giving a constraint to a particular column

FiltereddataofTable = A(A.Alpha > 100,:);

ongeveer 9 uur ago | 0

| accepted

Answered

how to find nearest date and its corresponding value !

load('date.mat'); load('AOD.mat'); d = datetime(A,'ConvertFrom','datenum'); [lo,i] = ismembertol(AOD_440(:,1),A,1,'DataScale'...

how to find nearest date and its corresponding value !

load('date.mat'); load('AOD.mat'); d = datetime(A,'ConvertFrom','datenum'); [lo,i] = ismembertol(AOD_440(:,1),A,1,'DataScale'...

ongeveer 24 uur ago | 0

| accepted

Answered

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

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

1 dag ago | 0

Answered

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

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

1 dag ago | 0

Answered

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

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

1 dag ago | 0

Answered

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

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

1 dag ago | 1

| accepted

Answered

How to write only non-NaN columns into Excel

T_in_Excel = T1(:,any(~isnan(T1{:,:}))); writetable(T_in_Excel, File_W)

How to write only non-NaN columns into Excel

T_in_Excel = T1(:,any(~isnan(T1{:,:}))); writetable(T_in_Excel, File_W)

2 dagen ago | 0

Answered

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;

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;

2 dagen ago | 0

Answered

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

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

2 dagen ago | 0

| accepted

Answered

concatenate arrays after performing addition

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),[])';

concatenate arrays after performing addition

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),[])';

2 dagen ago | 0

| accepted

Answered

classify array elements without so many if statement

out = discretize(A,0:.5:8)

classify array elements without so many if statement

out = discretize(A,0:.5:8)

2 dagen ago | 0

| accepted

Answered

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)

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)

2 dagen ago | 2

| accepted

Answered

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

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

2 dagen ago | 0

Answered

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{:}];...

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{:}];...

3 dagen ago | 0

Answered

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

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

3 dagen ago | 0

| accepted

Answered

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

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

3 dagen ago | 1

Answered

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

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

6 dagen ago | 1

| accepted

Answered

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

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

8 dagen ago | 0

Answered

Another Datetime conversion problem!

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

Another Datetime conversion problem!

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

8 dagen ago | 0

| accepted

Answered

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

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

12 dagen ago | 0

| accepted

Answered

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

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

14 dagen ago | 0

| accepted

Answered

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

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

14 dagen ago | 0

Answered

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

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

15 dagen ago | 0