Answered

For Loop Problem error

img=imread('C:\Users\Shalaw\Downloads\gray.jpeg'); [n,m]=size(img); imgs = mat2cell(img,[n,n]/2,[m,m]/2)'; for ii = 1:4 ...

For Loop Problem error

img=imread('C:\Users\Shalaw\Downloads\gray.jpeg'); [n,m]=size(img); imgs = mat2cell(img,[n,n]/2,[m,m]/2)'; for ii = 1:4 ...

3 days ago | 0

Answered

Calculate based on row

out = cellfun(@(x)-diff(x),your_cell_array,'un',0);

Calculate based on row

out = cellfun(@(x)-diff(x),your_cell_array,'un',0);

3 days ago | 1

| accepted

Answered

Creating dates tables with loop

dates = (datetime(2014,4,16,0,0,0):hours(1):datetime(2016,6,8,0,0,0))';

Creating dates tables with loop

dates = (datetime(2014,4,16,0,0,0):hours(1):datetime(2016,6,8,0,0,0))';

3 days ago | 1

| accepted

Answered

Problem in matrix dimension

T = readtable('fire_archive_M6_59116.csv'); a = T.acq_time/100; T.acq_date = T.acq_date + hours(fix(a)) + minutes(100*mod(a,1)...

Problem in matrix dimension

T = readtable('fire_archive_M6_59116.csv'); a = T.acq_time/100; T.acq_date = T.acq_date + hours(fix(a)) + minutes(100*mod(a,1)...

7 days ago | 0

| accepted

Answered

how to get combination of elements in a matrix in pair order

A=[3 5 6 7 8]; [y,x] = ndgrid(A); B = [x(:),y(:)]; B = B(diff(B,1,2) ~= 0,:);

how to get combination of elements in a matrix in pair order

A=[3 5 6 7 8]; [y,x] = ndgrid(A); B = [x(:),y(:)]; B = B(diff(B,1,2) ~= 0,:);

7 days ago | 0

Answered

how to loop in one time to get the max value minus the min value.

[a,~,c] = unique(cdata{1}(:,1:4),'rows','stable'); out = [a,accumarray(c,cdata{2},[],@(x)max(x) - min(x))];

how to loop in one time to get the max value minus the min value.

[a,~,c] = unique(cdata{1}(:,1:4),'rows','stable'); out = [a,accumarray(c,cdata{2},[],@(x)max(x) - min(x))];

7 days ago | 0

Answered

Checking for multiple values that are the same in a vector

C = C(:); d = [1;diff(C) ~= 0]; ii = cumsum(d); counts = accumarray(ii,1); k = find(counts >= 10); lo = ismember(ii,k); ...

Checking for multiple values that are the same in a vector

C = C(:); d = [1;diff(C) ~= 0]; ii = cumsum(d); counts = accumarray(ii,1); k = find(counts >= 10); lo = ismember(ii,k); ...

8 days ago | 1

| accepted

Answered

Error when multiplying two vectors

Use .* and ./: Want=IWant.*lett+20./lett+1;

Error when multiplying two vectors

Use .* and ./: Want=IWant.*lett+20./lett+1;

8 days ago | 0

| accepted

Answered

To equate one value to another?

May be like this: Let S - your signal. m = min(S); detph = 10/(max(S) - m)*(S - m) + 5;

To equate one value to another?

May be like this: Let S - your signal. m = min(S); detph = 10/(max(S) - m)*(S - m) + 5;

8 days ago | 0

| accepted

Answered

Find and edit interval of array when element is equal to a value?

i1 = double(diff([A,0]) == -2); ii = find(i1) - 3; i1(ii(ii > 0)) = -1; out = cumsum(i1,'revers').*A

Find and edit interval of array when element is equal to a value?

i1 = double(diff([A,0]) == -2); ii = find(i1) - 3; i1(ii(ii > 0)) = -1; out = cumsum(i1,'revers').*A

8 days ago | 1

Answered

how to store each ans which we get from loop in a 2-d array ?

Thin_image = single(rand(7) > .8); % for example out = conv2(Thin_image,ones(3),'valid'); ridge = sum(out(:) == 1); bifurca...

how to store each ans which we get from loop in a 2-d array ?

Thin_image = single(rand(7) > .8); % for example out = conv2(Thin_image,ones(3),'valid'); ridge = sum(out(:) == 1); bifurca...

9 days ago | 0

Answered

Comparing two matrix elements summing third and storing them separately

[B,BB] = groupsummary(A(:,3),A(:,1:2),'sum'); out = [BB{:},B];

Comparing two matrix elements summing third and storing them separately

[B,BB] = groupsummary(A(:,3),A(:,1:2),'sum'); out = [BB{:},B];

11 days ago | 0

Answered

How to generate a hankel and toeplitz array of blocks from three series?

A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]; [m,n] = size(A); C = num2cell(A,1); ii = triu(toeplitz(1:n-1)); H ...

How to generate a hankel and toeplitz array of blocks from three series?

A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]; [m,n] = size(A); C = num2cell(A,1); ii = triu(toeplitz(1:n-1)); H ...

11 days ago | 0

| accepted

Answered

how can remove the rows and columns which has ones in all

A=[1 1 1 1; 1 0 1 1;1 0 0 1]; AA = ~A; B = A(any(AA,2),any(AA));

how can remove the rows and columns which has ones in all

A=[1 1 1 1; 1 0 1 1;1 0 0 1]; AA = ~A; B = A(any(AA,2),any(AA));

11 days ago | 0

Answered

How to reshapre a matrix?

A =[... 0.5377 0.7254 0.4889 0.3252 1.8339 -0.0631 1.0347 -0.7549 -2.25...

How to reshapre a matrix?

A =[... 0.5377 0.7254 0.4889 0.3252 1.8339 -0.0631 1.0347 -0.7549 -2.25...

16 days ago | 1

| accepted

Answered

convert excel date and time to matlab

data = [ 9264 20180104 0.8021 9265 2018...

convert excel date and time to matlab

data = [ 9264 20180104 0.8021 9265 2018...

20 days ago | 0

| accepted

Answered

omit nonzero elemnt in cell

A(cellfun(@(x)numel(x) == 1 && x == 0,A)) = {[]};

omit nonzero elemnt in cell

A(cellfun(@(x)numel(x) == 1 && x == 0,A)) = {[]};

20 days ago | 0

| accepted

Answered

Interpolation of matrices corresponding to time vector

Variant with interp1: t = [1, 2, 3]; A = {[1, 1; 1, 1] ,[1, 0.9;0.95, .87] , [1.1, 0.85;0.91, .8]}; tt = [1.2, 2.1, 2.9]; ...

Interpolation of matrices corresponding to time vector

Variant with interp1: t = [1, 2, 3]; A = {[1, 1; 1, 1] ,[1, 0.9;0.95, .87] , [1.1, 0.85;0.91, .8]}; tt = [1.2, 2.1, 2.9]; ...

22 days ago | 1

| accepted

Answered

how to fill pre allocated matrix using two columns vectors

xx = 10:10:50; yy = 40:10:80; X = [ 35;43;22]; Y = [75;44;67]; m = numel(xx); n = numel(yy); out = zeros(m,n); x10 = ...

how to fill pre allocated matrix using two columns vectors

xx = 10:10:50; yy = 40:10:80; X = [ 35;43;22]; Y = [75;44;67]; m = numel(xx); n = numel(yy); out = zeros(m,n); x10 = ...

22 days ago | 1

| accepted

Answered

How to find nearby labels?

I =[... 1 1 1 2 3 3 1 1 2 2 3 3 4 4 4 5 5 3 ...

How to find nearby labels?

I =[... 1 1 1 2 3 3 1 1 2 2 3 3 4 4 4 5 5 3 ...

22 days ago | 0

| accepted

Answered

How to extract column and row index and the corresponding value from a matrix?

A = [0 1 4 7 6 0]; out = sortrows([fullfact(size(A)),A(:)]);

How to extract column and row index and the corresponding value from a matrix?

A = [0 1 4 7 6 0]; out = sortrows([fullfact(size(A)),A(:)]);

24 days ago | 1

Answered

can we check a condition at the end of a loop?

B = sort(repmat(1:8,6,4),2); [m,n] = size(B); for i0 = 1:m while any(~diff(B(i0,:))) B(i0,:) = B(i0,randperm(n))...

can we check a condition at the end of a loop?

B = sort(repmat(1:8,6,4),2); [m,n] = size(B); for i0 = 1:m while any(~diff(B(i0,:))) B(i0,:) = B(i0,randperm(n))...

26 days ago | 0

Answered

Calculating Means for Blocks of Data from Excel

A = [2 1 2 3 5 8 6 9 4 3 2 3 2 1 4 6 7 8 9 6 3 2]; lo = A(:) >= 4; loo = cumsum([0;diff(lo)==1]).*lo; lo3 = loo > 0; out =...

Calculating Means for Blocks of Data from Excel

A = [2 1 2 3 5 8 6 9 4 3 2 3 2 1 4 6 7 8 9 6 3 2]; lo = A(:) >= 4; loo = cumsum([0;diff(lo)==1]).*lo; lo3 = loo > 0; out =...

26 days ago | 0

Answered

How to change 0 to 1 and update a matrix

n = numel(x1); y1 = ~x1; % if MATLAB >= R2016b k = y1.*eye(n); % if MATLAB <= R2016a k = bsxfun(@times,y1,eye(n)); out...

How to change 0 to 1 and update a matrix

n = numel(x1); y1 = ~x1; % if MATLAB >= R2016b k = y1.*eye(n); % if MATLAB <= R2016a k = bsxfun(@times,y1,eye(n)); out...

26 days ago | 0

| accepted

Answered

Sort a list of files

data = { 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -10,00°' 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -15,00°'...

Sort a list of files

data = { 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -10,00°' 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -15,00°'...

27 days ago | 0

| accepted

Answered

Could anyone help me how to shuffle the numbers in each column

[m,n] = size(A); out = zeros(m,n); out([randperm(m) + (0:m-1)*m,randi(m,1,n-m)+m^2]) = A(A~=0);

Could anyone help me how to shuffle the numbers in each column

[m,n] = size(A); out = zeros(m,n); out([randperm(m) + (0:m-1)*m,randi(m,1,n-m)+m^2]) = A(A~=0);

30 days ago | 0

| accepted

Answered

How to compare two matrices of different dimentions and get the result in new column

Bnew = B.*(A == 2000);

How to compare two matrices of different dimentions and get the result in new column

Bnew = B.*(A == 2000);

1 month ago | 0

Answered

Vector operations not working correctly

cvPredictions = pval < epsilon;

Vector operations not working correctly

cvPredictions = pval < epsilon;

1 month ago | 0

| accepted

Answered

Replace numbers into a vector starts at the center? Looking for general format

vec =[0 0 0 0 0 ]; vec1 = [1 1 1]; z = pad(join(string(vec1),''),numel(vec),'both','0'); out = z{:} - '0'

Replace numbers into a vector starts at the center? Looking for general format

vec =[0 0 0 0 0 ]; vec1 = [1 1 1]; z = pad(join(string(vec1),''),numel(vec),'both','0'); out = z{:} - '0'

1 month ago | 1